import{l as unref,i as ref,m as inject,n as onUnmounted,q as computed,v as reactive,o as onMounted,x as nextTick,y as onActivated,z as onDeactivated,A as isRef,w as watch,B as getCurrentInstance,C as provide,D as isVNode,d as defineComponent,c as createVNode,E as onBeforeUnmount,T as Transition,G as withDirectives,H as vShow,I as Teleport,F as Fragment,J as mergeProps,j as createTextVNode,g as createApp,K as onBeforeUpdate,L as commonjsGlobal$1,M as getRequestHostname,h as browser,N as postMessage,O as commonjsRequire$1,P as getAugmentedNamespace,Q as watchEffect,f as formatZoom,s as state$3,_ as __vitePreload,R as open$1,e as close$1,a as createRouter,S as createWebHashHistory,U as queryString,V as listenerMessage,W as removeListenerMessage,k as state$4,t as toRefs,r as resolveComponent,p as promisefiyPostMessage,X as resolveDirective,Y as getPlatform,Z as store_legacy,$ as formatTime,a0 as TransitionGroup}from"./native-message.761fd015.js";import{i as isIOS$1,t as truthProp,c as createNamespace,w as withInstall,e as extend$2,r as routeProps,u as useRoute,B as Button,a as unknownProp,g as getZIndexStyle,b as isDef$1,n as noop$2,I as Icon,d as isObject$1,f as isPromise,h as isFunction$1,j as addUnit,L as Loading,k as inBrowser$1,p as pick,l as BORDER_LEFT,m as BORDER_TOP,o as unitToPx,q as Badge,s as BORDER_TOP_BOTTOM,v as route,x as BORDER,y as BORDER_BOTTOM,z as getSizeStyle}from"./index.dc7854b3.js";var replace=String.prototype.replace,percentTwenties=/%20/g,Format={RFC1738:"RFC1738",RFC3986:"RFC3986"},formats$3={default:Format.RFC3986,formatters:{RFC1738:function(B){return replace.call(B,percentTwenties,"+")},RFC3986:function(B){return String(B)}},RFC1738:Format.RFC1738,RFC3986:Format.RFC3986},formats$2=formats$3,has$2=Object.prototype.hasOwnProperty,isArray$4=Array.isArray,hexTable=function(){for(var B=[],R=0;R<256;++R)B.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return B}(),compactQueue=function(R){for(;R.length>1;){var F=R.pop(),D=F.obj[F.prop];if(isArray$4(D)){for(var G=[],U=0;U=48&&K<=57||K>=65&&K<=90||K>=97&&K<=122||U===formats$2.RFC1738&&(K===40||K===41)){q+=W.charAt(Y);continue}if(K<128){q=q+hexTable[K];continue}if(K<2048){q=q+(hexTable[192|K>>6]+hexTable[128|K&63]);continue}if(K<55296||K>=57344){q=q+(hexTable[224|K>>12]+hexTable[128|K>>6&63]+hexTable[128|K&63]);continue}Y+=1,K=65536+((K&1023)<<10|W.charCodeAt(Y)&1023),q+=hexTable[240|K>>18]+hexTable[128|K>>12&63]+hexTable[128|K>>6&63]+hexTable[128|K&63]}return q},compact=function(R){for(var F=[{obj:{o:R},prop:"o"}],D=[],G=0;G0?ne.join(",")||null:void 0}];else if(isArray$3(q))oe=q;else{var le=Object.keys(ne);oe=Y?le.sort(Y):le}for(var fe=0;fe0?Q+j:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$2=Array.isArray,defaults={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:utils$1.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(B){return B.replace(/&#(\d+);/g,function(R,F){return String.fromCharCode(parseInt(F,10))})},parseArrayValue=function(B,R){return B&&typeof B=="string"&&R.comma&&B.indexOf(",")>-1?B.split(","):B},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function(R,F){var D={},G=F.ignoreQueryPrefix?R.replace(/^\?/,""):R,U=F.parameterLimit===1/0?void 0:F.parameterLimit,W=G.split(F.delimiter,U),q=-1,Y,K=F.charset;if(F.charsetSentinel)for(Y=0;Y-1&&(te=isArray$2(te)?[te]:te),has.call(D,J)?D[J]=utils$1.combine(D[J],te):D[J]=te}return D},parseObject=function(B,R,F,D){for(var G=D?R:parseArrayValue(R,F),U=B.length-1;U>=0;--U){var W,q=B[U];if(q==="[]"&&F.parseArrays)W=[].concat(G);else{W=F.plainObjects?Object.create(null):{};var Y=q.charAt(0)==="["&&q.charAt(q.length-1)==="]"?q.slice(1,-1):q,K=parseInt(Y,10);!F.parseArrays&&Y===""?W={0:G}:!isNaN(K)&&q!==Y&&String(K)===Y&&K>=0&&F.parseArrays&&K<=F.arrayLimit?(W=[],W[K]=G):W[Y]=G}G=W}return G},parseKeys=function(R,F,D,G){if(!!R){var U=D.allowDots?R.replace(/\.([^.[]+)/g,"[$1]"):R,W=/(\[[^[\]]*])/,q=/(\[[^[\]]*])/g,Y=D.depth>0&&W.exec(U),K=Y?U.slice(0,Y.index):U,Z=[];if(K){if(!D.plainObjects&&has.call(Object.prototype,K)&&!D.allowPrototypes)return;Z.push(K)}for(var j=0;D.depth>0&&(Y=q.exec(U))!==null&&j-1};function normalizeName(B){if(typeof B!="string"&&(B=String(B)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(B)||B==="")throw new TypeError('Invalid character in header field name: "'+B+'"');return B.toLowerCase()}function normalizeValue(B){return typeof B!="string"&&(B=String(B)),B}function iteratorFor(B){var R={next:function(){var F=B.shift();return{done:F===void 0,value:F}}};return support.iterable&&(R[Symbol.iterator]=function(){return R}),R}function Headers(B){this.map={},B instanceof Headers?B.forEach(function(R,F){this.append(F,R)},this):Array.isArray(B)?B.forEach(function(R){this.append(R[0],R[1])},this):B&&Object.getOwnPropertyNames(B).forEach(function(R){this.append(R,B[R])},this)}Headers.prototype.append=function(B,R){B=normalizeName(B),R=normalizeValue(R);var F=this.map[B];this.map[B]=F?F+", "+R:R};Headers.prototype.delete=function(B){delete this.map[normalizeName(B)]};Headers.prototype.get=function(B){return B=normalizeName(B),this.has(B)?this.map[B]:null};Headers.prototype.has=function(B){return this.map.hasOwnProperty(normalizeName(B))};Headers.prototype.set=function(B,R){this.map[normalizeName(B)]=normalizeValue(R)};Headers.prototype.forEach=function(B,R){for(var F in this.map)this.map.hasOwnProperty(F)&&B.call(R,this.map[F],F,this)};Headers.prototype.keys=function(){var B=[];return this.forEach(function(R,F){B.push(F)}),iteratorFor(B)};Headers.prototype.values=function(){var B=[];return this.forEach(function(R){B.push(R)}),iteratorFor(B)};Headers.prototype.entries=function(){var B=[];return this.forEach(function(R,F){B.push([F,R])}),iteratorFor(B)};support.iterable&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);function consumed(B){if(B.bodyUsed)return Promise.reject(new TypeError("Already read"));B.bodyUsed=!0}function fileReaderReady(B){return new Promise(function(R,F){B.onload=function(){R(B.result)},B.onerror=function(){F(B.error)}})}function readBlobAsArrayBuffer(B){var R=new FileReader,F=fileReaderReady(R);return R.readAsArrayBuffer(B),F}function readBlobAsText(B){var R=new FileReader,F=fileReaderReady(R);return R.readAsText(B),F}function readArrayBufferAsText(B){for(var R=new Uint8Array(B),F=new Array(R.length),D=0;D=0&&typeof this._bodyInit!="string"&&(this._bodyInit=this._bodyText):typeof B=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):support.searchParams&&URLSearchParams.prototype.isPrototypeOf(B)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")},support.blob&&(this.blob=function(){var B=consumed(this);if(B)return B;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var B=consumed(this);return B||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var B=consumed(this);if(B)return B;if(this._bodyBlob)return readBlobAsText(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},support.formData&&(this.formData=function(){return this.text().then(decode$1)}),this.json=function(){return this.text().then(JSON.parse)},this}var methods=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function normalizeMethod(B){var R=B.toUpperCase();return methods.indexOf(R)>-1?R:B}function Request(B,R){if(!(this instanceof Request))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var F=R.body;if(B instanceof Request){if(B.bodyUsed)throw new TypeError("Already read");this.url=B.url,this.credentials=B.credentials,R.headers||(this.headers=new Headers(B.headers)),this.method=B.method,this.mode=B.mode,this.signal=B.signal,!F&&B._bodyInit!=null&&(F=B._bodyInit,B.bodyUsed=!0)}else this.url=String(B);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new Headers(R.headers)),this.method=normalizeMethod(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(F),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var D=/([?&])_=[^&]*/;if(D.test(this.url))this.url=this.url.replace(D,"$1_="+new Date().getTime());else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode$1(B){var R=new FormData;return B.trim().split("&").forEach(function(F){if(F){var D=F.split("="),G=D.shift().replace(/\+/g," "),U=D.join("=").replace(/\+/g," ");R.append(decodeURIComponent(G),decodeURIComponent(U))}}),R}function parseHeaders(B){var R=new Headers,F=B.replace(/\r?\n[\t ]+/g," ");return F.split("\r").map(function(D){return D.indexOf(` `)===0?D.substr(1,D.length):D}).forEach(function(D){var G=D.split(":"),U=G.shift().trim();if(U){var W=G.join(":").trim();R.append(U,W)}}),R}Body.call(Request.prototype);function Response(B,R){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new Headers(R.headers),this.url=R.url||"",this._initBody(B)}Body.call(Response.prototype);Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})};Response.error=function(){var B=new Response(null,{status:0,statusText:""});return B.type="error",B};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(B,R){if(redirectStatuses.indexOf(R)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:R,headers:{location:B}})};var DOMException=global$1.DOMException;try{new DOMException}catch{DOMException=function(R,F){this.message=R,this.name=F;var D=Error(R);this.stack=D.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(B,R){return new Promise(function(F,D){var G=new Request(B,R);if(G.signal&&G.signal.aborted)return D(new DOMException("Aborted","AbortError"));var U=new XMLHttpRequest;function W(){U.abort()}U.onload=function(){var Y={status:U.status,statusText:U.statusText,headers:parseHeaders(U.getAllResponseHeaders()||"")};Y.url="responseURL"in U?U.responseURL:Y.headers.get("X-Request-URL");var K="response"in U?U.response:U.responseText;setTimeout(function(){F(new Response(K,Y))},0)},U.onerror=function(){setTimeout(function(){D(new TypeError("Network request failed"))},0)},U.ontimeout=function(){setTimeout(function(){D(new TypeError("Network request failed"))},0)},U.onabort=function(){setTimeout(function(){D(new DOMException("Aborted","AbortError"))},0)};function q(Y){try{return Y===""&&global$1.location.href?global$1.location.href:Y}catch{return Y}}U.open(G.method,q(G.url),!0),G.credentials==="include"?U.withCredentials=!0:G.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&(support.blob?U.responseType="blob":support.arrayBuffer&&G.headers.get("Content-Type")&&G.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(U.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof Headers)?Object.getOwnPropertyNames(R.headers).forEach(function(Y){U.setRequestHeader(Y,normalizeValue(R.headers[Y]))}):G.headers.forEach(function(Y,K){U.setRequestHeader(K,Y)}),G.signal&&(G.signal.addEventListener("abort",W),U.onreadystatechange=function(){U.readyState===4&&G.signal.removeEventListener("abort",W)}),U.send(typeof G._bodyInit=="undefined"?null:G._bodyInit)})}fetch$2.polyfill=!0;global$1.fetch||(global$1.fetch=fetch$2,global$1.Headers=Headers,global$1.Request=Request,global$1.Response=Response);self.fetch.bind(self);function _defineProperty(B,R,F){return R in B?Object.defineProperty(B,R,{value:F,enumerable:!0,configurable:!0,writable:!0}):B[R]=F,B}var defineProperty=_defineProperty;function _objectSpread(B){for(var R=1;R1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1,defaultInstance:!1},G=!1,U=!1,W=!1;if(typeof D=="number"?(process&&process.env,G=!0,U=!1):_typeof_1(D)==="object"&&D&&(U=D.global||!1,G=D.core||!1,W=D.defaultInstance||!1),U){B.globalMiddlewares.splice(B.globalMiddlewares.length-B.defaultGlobalMiddlewaresLength,0,F);return}if(G){B.coreMiddlewares.splice(B.coreMiddlewares.length-B.defaultCoreMiddlewaresLength,0,F);return}if(W){this.defaultMiddlewares.push(F);return}this.middlewares.push(F)}},{key:"execute",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,D=compose([].concat(toConsumableArray(this.middlewares),toConsumableArray(this.defaultMiddlewares),toConsumableArray(B.globalMiddlewares),toConsumableArray(B.coreMiddlewares)));return D(F)}}]),B}();Onion.globalMiddlewares=[];Onion.defaultGlobalMiddlewaresLength=0;Onion.coreMiddlewares=[];Onion.defaultCoreMiddlewaresLength=0;function _assertThisInitialized(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}var assertThisInitialized=_assertThisInitialized;function _possibleConstructorReturn(B,R){return R&&(_typeof_1(R)==="object"||typeof R=="function")?R:assertThisInitialized(B)}var possibleConstructorReturn=_possibleConstructorReturn,getPrototypeOf=createCommonjsModule$1(function(B){function R(F){return B.exports=R=Object.setPrototypeOf?Object.getPrototypeOf:function(G){return G.__proto__||Object.getPrototypeOf(G)},R(F)}B.exports=R}),setPrototypeOf=createCommonjsModule$1(function(B){function R(F,D){return B.exports=R=Object.setPrototypeOf||function(U,W){return U.__proto__=W,U},R(F,D)}B.exports=R});function _inherits(B,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");B.prototype=Object.create(R&&R.prototype,{constructor:{value:B,writable:!0,configurable:!0}}),R&&setPrototypeOf(B,R)}var inherits=_inherits;function _isNativeFunction(B){return Function.toString.call(B).indexOf("[native code]")!==-1}var isNativeFunction=_isNativeFunction,construct=createCommonjsModule$1(function(B){function R(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function F(D,G,U){return R()?B.exports=F=Reflect.construct:B.exports=F=function(q,Y,K){var Z=[null];Z.push.apply(Z,Y);var j=Function.bind.apply(q,Z),Q=new j;return K&&setPrototypeOf(Q,K.prototype),Q},F.apply(null,arguments)}B.exports=F}),wrapNativeSuper=createCommonjsModule$1(function(B){function R(F){var D=typeof Map=="function"?new Map:void 0;return B.exports=R=function(U){if(U===null||!isNativeFunction(U))return U;if(typeof U!="function")throw new TypeError("Super expression must either be null or a function");if(typeof D!="undefined"){if(D.has(U))return D.get(U);D.set(U,W)}function W(){return construct(U,arguments,getPrototypeOf(this).constructor)}return W.prototype=Object.create(U.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),setPrototypeOf(W,U)},R(F)}B.exports=R}),MapCache=function(){function B(R){classCallCheck(this,B),this.cache=new Map,this.timer={},this.extendOptions(R)}return createClass(B,[{key:"extendOptions",value:function(F){this.maxCache=F.maxCache||0}},{key:"get",value:function(F){return this.cache.get(JSON.stringify(F))}},{key:"set",value:function(F,D){var G=this,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var W=toConsumableArray(this.cache.keys())[0];this.cache.delete(W),this.timer[W]&&clearTimeout(this.timer[W])}var q=JSON.stringify(F);this.cache.set(q,D),U>0&&(this.timer[q]=setTimeout(function(){G.cache.delete(q),delete G.timer[q]},U))}},{key:"delete",value:function(F){var D=JSON.stringify(F);return delete this.timer[D],this.cache.delete(D)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),B}(),RequestError=function(B){inherits(R,B);function R(F,D){var G,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"RequestError";return classCallCheck(this,R),G=possibleConstructorReturn(this,getPrototypeOf(R).call(this,F)),G.name="RequestError",G.request=D,G.type=U,G}return R}(wrapNativeSuper(Error)),ResponseError=function(B){inherits(R,B);function R(F,D,G,U){var W,q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"ResponseError";return classCallCheck(this,R),W=possibleConstructorReturn(this,getPrototypeOf(R).call(this,D||F.statusText)),W.name="ResponseError",W.data=G,W.response=F,W.request=U,W.type=q,W}return R}(wrapNativeSuper(Error));function readerGBK(B){return new Promise(function(R,F){var D=new FileReader;D.onload=function(){R(D.result)},D.onerror=F,D.readAsText(B,"GBK")})}function safeJsonParse(B){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,D=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;try{return JSON.parse(B)}catch{if(R)throw new ResponseError(F,"JSON.parse fail",B,D,"ParseError")}return B}function timeout2Throw(B,R){return new Promise(function(F,D){setTimeout(function(){D(new RequestError("timeout of ".concat(B,"ms exceeded"),R,"Timeout"))},B)})}function cancel2Throw(B){return new Promise(function(R,F){B.cancelToken&&B.cancelToken.promise.then(function(D){F(D)})})}var toString$2=Object.prototype.toString;function getEnv(){var B;return typeof process!="undefined"&&toString$2.call(process)==="[object process]"&&(B="NODE"),typeof XMLHttpRequest!="undefined"&&(B="BROWSER"),B}function isArray$1(B){return _typeof_1(B)==="object"&&Object.prototype.toString.call(B)==="[object Array]"}function isURLSearchParams(B){return typeof URLSearchParams!="undefined"&&B instanceof URLSearchParams}function isDate(B){return _typeof_1(B)==="object"&&Object.prototype.toString.call(B)==="[object Date]"}function isObject(B){return B!==null&&_typeof_1(B)==="object"}function forEach2ObjArr(B,R){if(!!B)if(_typeof_1(B)!=="object"&&(B=[B]),isArray$1(B))for(var F=0;F1&&arguments[1]!==void 0?arguments[1]:{},D=F.prefix,G=F.suffix;return D&&(R="".concat(D).concat(R)),G&&(R="".concat(R).concat(G)),{url:R,options:F}},warnedCoreType=!1;function __defaultValidateCache(B,R){var F=R.method,D=F===void 0?"get":F;return D.toLowerCase()==="get"}function fetchMiddleware(B,R){if(!B)return R();var F=B.req;F=F===void 0?{}:F;var D=F.options,G=D===void 0?{}:D,U=F.url,W=U===void 0?"":U,q=B.cache,Y=B.responseInterceptors,K=G.timeout,Z=K===void 0?0:K,j=G.__umiRequestCoreType__,Q=j===void 0?"normal":j,J=G.useCache,te=J===void 0?!1:J,ne=G.method,ie=ne===void 0?"get":ne,re=G.params,oe=G.ttl,le=G.validateCache,fe=le===void 0?__defaultValidateCache:le;if(Q!=="normal")return process&&process.env,R();var he=fetch;if(!he)throw new Error("Global fetch not exist!");var ge=getEnv()==="BROWSER",ce=fe(W,G)&&te&≥if(ce){var me=q.get({url:W,params:re,method:ie});if(me)return me=me.clone(),me.useCache=!0,B.res=me,R()}var ye;return Z>0?ye=Promise.race([cancel2Throw(G),he(W,G),timeout2Throw(Z,B.req)]):ye=Promise.race([cancel2Throw(G),he(W,G)]),Y.forEach(function(ve){ye=ye.then(function(pe){var be=typeof pe.clone=="function"?pe.clone():pe;return ve(be,G)})}),ye.then(function(ve){if(ce&&ve.status===200){var pe=ve.clone();pe.useCache=!0,q.set({url:W,params:re,method:ie},pe,oe)}return B.res=ve,R()})}function parseResponseMiddleware(B,R){var F;return R().then(function(){if(!!B){var D=B.res,G=D===void 0?{}:D,U=B.req,W=U===void 0?{}:U,q=W||{},Y=q.options;Y=Y===void 0?{}:Y;var K=Y.responseType,Z=K===void 0?"json":K,j=Y.charset,Q=j===void 0?"utf8":j;Y.getResponse;var J=Y.throwErrIfParseFail,te=J===void 0?!1:J,ne=Y.parseResponse,ie=ne===void 0?!0:ne;if(!!ie&&!(!G||!G.clone)){if(F=getEnv()==="BROWSER"?G.clone():G,F.useCache=G.useCache||!1,Q==="gbk")try{return G.blob().then(readerGBK).then(function(re){return safeJsonParse(re,!1,F,W)})}catch(re){throw new ResponseError(F,re.message,null,W,"ParseError")}else if(Z==="json")return G.text().then(function(re){return safeJsonParse(re,te,F,W)});try{return G[Z]()}catch{throw new ResponseError(F,"responseType not support",null,W,"ParseError")}}}}).then(function(D){if(!!B){B.res;var G=B.req,U=G===void 0?{}:G,W=U||{},q=W.options;q=q===void 0?{}:q;var Y=q.getResponse,K=Y===void 0?!1:Y;if(!!F){if(F.status>=200&&F.status<300){if(K){B.res={data:D,response:F};return}B.res=D;return}throw new ResponseError(F,"http error",D,U,"HttpError")}}}).catch(function(D){if(D instanceof RequestError||D instanceof ResponseError)throw D;var G=B.req,U=B.res;throw D.request=D.request||G,D.response=D.response||U,D.type=D.type||D.name,D.data=D.data||void 0,D})}function simplePostMiddleware(B,R){if(!B)return R();var F=B.req;F=F===void 0?{}:F;var D=F.options,G=D===void 0?{}:D,U=G.method,W=U===void 0?"get":U;if(["post","put","patch","delete"].indexOf(W.toLowerCase())===-1)return R();var q=G.requestType,Y=q===void 0?"json":q,K=G.data;if(K){var Z=Object.prototype.toString.call(K);Z==="[object Object]"||Z==="[object Array]"?Y==="json"?(G.headers=objectSpread({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},G.headers),G.body=JSON.stringify(K)):Y==="form"&&(G.headers=objectSpread({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},G.headers),G.body=reqStringify(K)):(G.headers=objectSpread({Accept:"application/json"},G.headers),G.body=K)}return B.req.options=G,R()}function paramsSerialize(B,R){var F,D;if(B)if(R)F=R(B);else if(isURLSearchParams(B))F=B.toString();else if(isArray$1(B))D=[],forEach2ObjArr(B,function(U){U===null||typeof U=="undefined"?D.push(U):D.push(isObject(U)?JSON.stringify(U):U)}),F=reqStringify(D);else{D={},forEach2ObjArr(B,function(U,W){var q=U;U===null||typeof U=="undefined"?D[W]=U:isDate(U)?q=U.toISOString():isArray$1(U)?q=U:isObject(U)&&(q=JSON.stringify(U)),D[W]=q});var G=reqStringify(D);F=G}return F}function simpleGetMiddleware(B,R){if(!B)return R();var F=B.req;F=F===void 0?{}:F;var D=F.options,G=D===void 0?{}:D,U=G.paramsSerializer,W=G.params,q=B.req;q=q===void 0?{}:q;var Y=q.url,K=Y===void 0?"":Y;G.method=G.method?G.method.toUpperCase():"GET",G.credentials=G.credentials||"same-origin";var Z=paramsSerialize(W,U);if(B.req.originUrl=K,Z){var j=K.indexOf("?")!==-1?"&":"?";B.req.url="".concat(K).concat(j).concat(Z)}return B.req.options=G,R()}var globalMiddlewares=[simplePostMiddleware,simpleGetMiddleware,parseResponseMiddleware],coreMiddlewares=[fetchMiddleware];Onion.globalMiddlewares=globalMiddlewares;Onion.defaultGlobalMiddlewaresLength=globalMiddlewares.length;Onion.coreMiddlewares=coreMiddlewares;Onion.defaultCoreMiddlewaresLength=coreMiddlewares.length;var Core=function(){function B(R){classCallCheck(this,B),this.onion=new Onion([]),this.fetchIndex=0,this.mapCache=new MapCache(R),this.initOptions=R,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return createClass(B,[{key:"use",value:function(F){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1};return this.onion.use(F,D),this}},{key:"extendOptions",value:function(F){this.initOptions=mergeRequestOptions(this.initOptions,F),this.mapCache.extendOptions(F)}},{key:"dealRequestInterceptors",value:function(F){var D=function(W,q){return W.then(function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return F.req.url=Y.url||F.req.url,F.req.options=Y.options||F.req.options,q(F.req.url,F.req.options)})},G=[].concat(toConsumableArray(B.requestInterceptors),toConsumableArray(this.instanceRequestInterceptors));return G.reduce(D,Promise.resolve()).then(function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return F.req.url=U.url||F.req.url,F.req.options=U.options||F.req.options,Promise.resolve()})}},{key:"request",value:function(F,D){var G=this,U=this.onion,W={req:{url:F,options:D},res:null,cache:this.mapCache,responseInterceptors:[].concat(toConsumableArray(B.responseInterceptors),toConsumableArray(this.instanceResponseInterceptors))};if(typeof F!="string")throw new Error("url MUST be a string");return new Promise(function(q,Y){G.dealRequestInterceptors(W).then(function(){return U.execute(W)}).then(function(){q(W.res)}).catch(function(K){var Z=W.req.options.errorHandler;if(Z)try{var j=Z(K);q(j)}catch(Q){Y(Q)}else Y(K)})})}}],[{key:"requestUse",value:function(F){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof F!="function")throw new TypeError("Interceptor must be function!");D.global?B.requestInterceptors.push(F):this.instanceRequestInterceptors.push(F)}},{key:"responseUse",value:function(F){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof F!="function")throw new TypeError("Interceptor must be function!");D.global?B.responseInterceptors.push(F):this.instanceResponseInterceptors.push(F)}}]),B}();Core.requestInterceptors=[addfix];Core.responseInterceptors=[];function Cancel(B){this.message=B}Cancel.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"};Cancel.prototype.__CANCEL__=!0;function CancelToken(B){if(typeof B!="function")throw new TypeError("executor must be a function.");var R;this.promise=new Promise(function(G){R=G});var F=this;B(function(G){F.reason||(F.reason=new Cancel(G),R(F.reason))})}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};CancelToken.source=function(){var R,F=new CancelToken(function(G){R=G});return{token:F,cancel:R}};function isCancel(B){return!!(B&&B.__CANCEL__)}var request$1=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=new Core(R),D=function(W){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=mergeRequestOptions(F.initOptions,q);return F.request(W,Y)};D.use=F.use.bind(F),D.fetchIndex=F.fetchIndex,D.interceptors={request:{use:Core.requestUse.bind(F)},response:{use:Core.responseUse.bind(F)}};var G=["get","post","delete","put","patch","head","options","rpc"];return G.forEach(function(U){D[U]=function(W,q){return D(W,objectSpread({},q,{method:U}))}}),D.Cancel=Cancel,D.CancelToken=CancelToken,D.isCancel=isCancel,D.extendOptions=F.extendOptions.bind(F),D.middlewares={instance:F.onion.middlewares,defaultInstance:F.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},D},extend$1=function(R){return request$1(R)};request$1({parseResponse:!1});var request$1$1=request$1({});function clamp(B,R,F){return Math.min(Math.max(B,R),F)}function trimExtraChar(B,R,F){var D=B.indexOf(R);return D===-1?B:R==="-"&&D!==0?B.slice(0,D):B.slice(0,D+1)+B.slice(D).replace(F,"")}function formatNumber(B,R=!0,F=!0){R?B=trimExtraChar(B,".",/\./g):B=B.split(".")[0],F?B=trimExtraChar(B,"-",/-/g):B=B.replace(/-/,"");var D=R?/[^-0-9.]/g:/[^-0-9]/g;return B.replace(D,"")}function addNumber(B,R){var F=Math.pow(10,10);return Math.round((B+R)*F)/F}function isHidden(B){var R=unref(B);if(!R)return!1;var F=window.getComputedStyle(R),D=F.display==="none",G=R.offsetParent===null&&F.position!=="fixed";return D||G}function stopPropagation(B){B.stopPropagation()}function preventDefault(B,R){(typeof B.cancelable!="boolean"||B.cancelable)&&B.preventDefault(),R&&stopPropagation(B)}function trigger(B,R){var F=document.createEvent("HTMLEvents");F.initEvent(R,!0,!0),B.dispatchEvent(F)}function isWindow$1(B){return B===window}function getScrollTop(B){var R="scrollTop"in B?B.scrollTop:B.pageYOffset;return Math.max(R,0)}function setScrollTop(B,R){"scrollTop"in B?B.scrollTop=R:B.scrollTo(B.scrollX,R)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(B){setScrollTop(window,B),setScrollTop(document.body,B)}function getElementTop(B,R){if(isWindow$1(B))return 0;var F=R?getScrollTop(R):getRootScrollTop();return B.getBoundingClientRect().top+F}function getVisibleHeight(B){return isWindow$1(B)?B.innerHeight:B.getBoundingClientRect().height}function getVisibleTop(B){return isWindow$1(B)?0:B.getBoundingClientRect().top}var isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}const inBrowser=typeof window!="undefined";function raf$2(B){return inBrowser?requestAnimationFrame(B):-1}function cancelRaf(B){inBrowser&&cancelAnimationFrame(B)}function doubleRaf(B){raf$2(()=>raf$2(B))}const isWindow=B=>B===window,makeDOMRect=(B,R)=>({top:0,left:0,right:B,bottom:R,width:B,height:R}),useRect=B=>{const R=unref(B);if(isWindow(R)){const F=R.innerWidth,D=R.innerHeight;return makeDOMRect(F,D)}return R!=null&&R.getBoundingClientRect?R.getBoundingClientRect():makeDOMRect(0,0)};function useToggle(B=!1){const R=ref(B);return[R,(D=!R.value)=>{R.value=D}]}function useParent(B){const R=inject(B,null);if(R){const F=getCurrentInstance(),{link:D,unlink:G,internalChildren:U}=R;D(F),onUnmounted(()=>G(F));const W=computed(()=>U.indexOf(F));return{parent:R,index:W}}return{parent:null,index:ref(-1)}}function flattenVNodes(B){const R=[],F=D=>{Array.isArray(D)&&D.forEach(G=>{var U;isVNode(G)&&(R.push(G),(U=G.component)!=null&&U.subTree&&F(G.component.subTree.children),G.children&&F(G.children))})};return F(B),R}function sortChildren(B,R,F){const D=flattenVNodes(B.subTree.children);F.sort((U,W)=>D.indexOf(U.vnode)-D.indexOf(W.vnode));const G=F.map(U=>U.proxy);R.sort((U,W)=>{const q=G.indexOf(U),Y=G.indexOf(W);return q-Y})}function useChildren(B){const R=reactive([]),F=reactive([]),D=getCurrentInstance();return{children:R,linkChildren:U=>{provide(B,Object.assign({link:Y=>{Y.proxy&&(F.push(Y),R.push(Y.proxy),sortChildren(D,R,F))},unlink:Y=>{const K=F.indexOf(Y);R.splice(K,1),F.splice(K,1)},children:R,internalChildren:F},U))}}}function onMountedOrActivated(B){let R;onMounted(()=>{B(),nextTick(()=>{R=!0})}),onActivated(()=>{R&&B()})}function useEventListener(B,R,F={}){if(!inBrowser)return;const{target:D=window,passive:G=!1,capture:U=!1}=F;let W;const q=K=>{const Z=unref(K);Z&&!W&&(Z.addEventListener(B,R,{capture:U,passive:G}),W=!0)},Y=K=>{const Z=unref(K);Z&&W&&(Z.removeEventListener(B,R,U),W=!1)};onUnmounted(()=>Y(D)),onDeactivated(()=>Y(D)),onMountedOrActivated(()=>q(D)),isRef(D)&&watch(D,(K,Z)=>{Y(Z),q(K)})}function useClickAway(B,R,F={}){if(!inBrowser)return;const{eventName:D="click"}=F;useEventListener(D,U=>{const W=unref(B);W&&!W.contains(U.target)&&R(U)},{target:document})}let width,height;function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser)){const B=()=>{width.value=window.innerWidth,height.value=window.innerHeight};B(),window.addEventListener("resize",B,{passive:!0}),window.addEventListener("orientationchange",B,{passive:!0})}return{width,height}}const overflowScrollReg=/scroll|auto/i,defaultRoot=inBrowser?window:void 0;function isElement$1(B){return B.tagName!=="HTML"&&B.tagName!=="BODY"&&B.nodeType===1}function getScrollParent$1(B,R=defaultRoot){let F=B;for(;F&&F!==R&&isElement$1(F);){const{overflowY:D}=window.getComputedStyle(F);if(overflowScrollReg.test(D))return F;F=F.parentNode}return R}function useScrollParent(B,R=defaultRoot){const F=ref();return onMounted(()=>{B.value&&(F.value=getScrollParent$1(B.value,R))}),F}let visibility;function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser)){const B=()=>{visibility.value=document.hidden?"hidden":"visible"};B(),window.addEventListener("visibilitychange",B)}return visibility}var[name$q,bem$q]=createNamespace("action-bar"),ACTION_BAR_KEY=Symbol(name$q),_ActionBar=defineComponent({name:name$q,props:{safeAreaInsetBottom:truthProp},setup(B,{slots:R}){var{linkChildren:F}=useChildren(ACTION_BAR_KEY);return F(),()=>createVNode("div",{class:bem$q({unfit:!B.safeAreaInsetBottom})},[R.default==null?void 0:R.default()])}}),ActionBar=withInstall(_ActionBar);function useExpose(B){var R=getCurrentInstance();R&&extend$2(R.proxy,B)}var[name$p,bem$p]=createNamespace("action-bar-button"),_ActionBarButton=defineComponent({name:name$p,props:extend$2({},routeProps,{type:String,text:String,icon:String,color:String,loading:Boolean,disabled:Boolean}),setup(B,{slots:R}){var F=useRoute(),{parent:D,index:G}=useParent(ACTION_BAR_KEY),U=computed(()=>{if(D){var q=D.children[G.value-1];return!(q&&"isButton"in q)}}),W=computed(()=>{if(D){var q=D.children[G.value+1];return!(q&&"isButton"in q)}});return useExpose({isButton:!0}),()=>{var{type:q,icon:Y,text:K,color:Z,loading:j,disabled:Q}=B;return createVNode(Button,{class:bem$p([q,{last:W.value,first:U.value}]),size:"large",type:q,icon:Y,color:Z,loading:j,disabled:Q,onClick:F},{default:()=>[R.default?R.default():K]})}}}),ActionBarButton=withInstall(_ActionBarButton),popupSharedProps={show:Boolean,zIndex:[Number,String],overlay:truthProp,duration:[Number,String],teleport:[String,Object],lockScroll:truthProp,lazyRender:truthProp,overlayStyle:Object,overlayClass:unknownProp,transitionAppear:Boolean,closeOnClickOverlay:truthProp},popupSharedPropKeys=Object.keys(popupSharedProps),MIN_DISTANCE=10;function getDirection(B,R){return B>R&&B>MIN_DISTANCE?"horizontal":R>B&&R>MIN_DISTANCE?"vertical":""}function useTouch(){var B=ref(0),R=ref(0),F=ref(0),D=ref(0),G=ref(0),U=ref(0),W=ref(""),q=()=>W.value==="vertical",Y=()=>W.value==="horizontal",K=()=>{F.value=0,D.value=0,G.value=0,U.value=0,W.value=""},Z=Q=>{K(),B.value=Q.touches[0].clientX,R.value=Q.touches[0].clientY},j=Q=>{var J=Q.touches[0];F.value=J.clientX<0?0:J.clientX-B.value,D.value=J.clientY-R.value,G.value=Math.abs(F.value),U.value=Math.abs(D.value),W.value||(W.value=getDirection(G.value,U.value))};return{move:j,start:Z,reset:K,startX:B,startY:R,deltaX:F,deltaY:D,offsetX:G,offsetY:U,direction:W,isVertical:q,isHorizontal:Y}}var totalLockCount=0,BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(B,R){var F=useTouch(),D=Y=>{F.move(Y);var K=F.deltaY.value>0?"10":"01",Z=getScrollParent$1(Y.target,B.value),{scrollHeight:j,offsetHeight:Q,scrollTop:J}=Z,te="11";J===0?te=Q>=j?"00":"01":J+Q>=j&&(te="10"),te!=="11"&&F.isVertical()&&!(parseInt(te,2)&parseInt(K,2))&&preventDefault(Y,!0)},G=()=>{document.addEventListener("touchstart",F.start),document.addEventListener("touchmove",D,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},U=()=>{totalLockCount&&(document.removeEventListener("touchstart",F.start),document.removeEventListener("touchmove",D),totalLockCount--,totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},W=()=>{R()&&G()},q=()=>{R()&&U()};onMountedOrActivated(W),onDeactivated(q),onBeforeUnmount(q),watch(R,Y=>{Y?G():U()})}function useLazyRender(B){var R=ref(!1);return watch(B,F=>{F&&(R.value=F)},{immediate:!0}),F=>()=>R.value?F():null}var POPUP_TOGGLE_KEY=Symbol();function onPopupReopen(B){var R=inject(POPUP_TOGGLE_KEY,null);R&&watch(R,F=>{F&&B()})}var[name$o,bem$o]=createNamespace("overlay"),_Overlay=defineComponent({name:name$o,props:{show:Boolean,zIndex:[Number,String],duration:[Number,String],className:unknownProp,lockScroll:truthProp,customStyle:Object},setup(B,{slots:R}){var F=useLazyRender(()=>B.show),D=U=>{preventDefault(U,!0)},G=F(()=>{var U=extend$2(getZIndexStyle(B.zIndex),B.customStyle);return isDef$1(B.duration)&&(U.animationDuration=B.duration+"s"),withDirectives(createVNode("div",{style:U,class:[bem$o(),B.className],onTouchmove:B.lockScroll?D:noop$2},[R.default==null?void 0:R.default()]),[[vShow,B.show]])});return()=>createVNode(Transition,{name:"van-fade"},{default:()=>[G()]})}}),Overlay=withInstall(_Overlay),[name$n,bem$n]=createNamespace("popup"),globalZIndex=2e3,_Popup=defineComponent({name:name$n,inheritAttrs:!1,props:extend$2({},popupSharedProps,{round:Boolean,closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,safeAreaInsetBottom:Boolean,position:{type:String,default:"center"},closeIcon:{type:String,default:"cross"},closeIconPosition:{type:String,default:"top-right"}}),emits:["open","close","click","opened","closed","update:show","click-overlay","click-close-icon"],setup(B,{emit:R,attrs:F,slots:D}){var G,U,W=ref(),q=ref(),Y=useLazyRender(()=>B.show||!B.lazyRender),K=computed(()=>{var he={zIndex:W.value};if(isDef$1(B.duration)){var ge=B.position==="center"?"animationDuration":"transitionDuration";he[ge]=B.duration+"s"}return he}),Z=()=>{G||(B.zIndex!==void 0&&(globalZIndex=+B.zIndex),G=!0,W.value=++globalZIndex)},j=()=>{G&&(G=!1,R("update:show",!1))},Q=he=>{R("click-overlay",he),B.closeOnClickOverlay&&j()},J=()=>{if(B.overlay)return createVNode(Overlay,{show:B.show,class:B.overlayClass,zIndex:W.value,duration:B.duration,customStyle:B.overlayStyle,onClick:Q},{default:D["overlay-content"]})},te=he=>{R("click-close-icon",he),j()},ne=()=>{if(B.closeable)return createVNode(Icon,{role:"button",tabindex:0,name:B.closeIcon,class:bem$n("close-icon",B.closeIconPosition),classPrefix:B.iconPrefix,onClick:te},null)},ie=he=>R("click",he),re=()=>R("opened"),oe=()=>R("closed"),le=Y(()=>{var{round:he,position:ge,safeAreaInsetBottom:ce}=B;return withDirectives(createVNode("div",mergeProps({ref:q,style:K.value,class:bem$n({round:he,[ge]:ge,"safe-area-inset-bottom":ce}),onClick:ie},F),[D.default==null?void 0:D.default(),ne()]),[[vShow,B.show]])}),fe=()=>{var{position:he,transition:ge,transitionAppear:ce}=B,me=he==="center"?"van-fade":"van-popup-slide-"+he;return createVNode(Transition,{name:ge||me,appear:ce,onAfterEnter:re,onAfterLeave:oe},{default:()=>[le()]})};return watch(()=>B.show,he=>{he?(Z(),R("open")):(j(),R("close"))}),useExpose({popupRef:q}),useLockScroll(q,()=>B.show&&B.lockScroll),useEventListener("popstate",()=>{B.closeOnPopstate&&(j(),U=!1)}),onMounted(()=>{B.show&&Z()}),onActivated(()=>{U&&(R("update:show",!0),U=!1)}),onDeactivated(()=>{B.show&&(j(),U=!0)}),provide(POPUP_TOGGLE_KEY,()=>B.show),()=>B.teleport?createVNode(Teleport,{to:B.teleport},{default:()=>[J(),fe()]}):createVNode(Fragment,null,[J(),fe()])}}),Popup=withInstall(_Popup),[name$m,bem$m]=createNamespace("cell"),cellProps={icon:String,size:String,title:[Number,String],value:[Number,String],label:[Number,String],center:Boolean,isLink:Boolean,border:truthProp,required:Boolean,iconPrefix:String,valueClass:unknownProp,labelClass:unknownProp,titleClass:unknownProp,titleStyle:null,arrowDirection:String,clickable:{type:Boolean,default:null}},_Cell=defineComponent({name:name$m,props:extend$2({},cellProps,routeProps),setup(B,{slots:R}){var F=useRoute(),D=()=>{var Y=R.label||isDef$1(B.label);if(Y)return createVNode("div",{class:[bem$m("label"),B.labelClass]},[R.label?R.label():B.label])},G=()=>{if(R.title||isDef$1(B.title))return createVNode("div",{class:[bem$m("title"),B.titleClass],style:B.titleStyle},[R.title?R.title():createVNode("span",null,[B.title]),D()])},U=()=>{var Y=R.default||isDef$1(B.value);if(Y){var K=R.title||isDef$1(B.title);return createVNode("div",{class:[bem$m("value",{alone:!K}),B.valueClass]},[R.default?R.default():createVNode("span",null,[B.value])])}},W=()=>{if(R.icon)return R.icon();if(B.icon)return createVNode(Icon,{name:B.icon,class:bem$m("left-icon"),classPrefix:B.iconPrefix},null)},q=()=>{if(R["right-icon"])return R["right-icon"]();if(B.isLink){var Y=B.arrowDirection?"arrow-"+B.arrowDirection:"arrow";return createVNode(Icon,{name:Y,class:bem$m("right-icon")},null)}};return()=>{var Y,{size:K,center:Z,border:j,isLink:Q,required:J}=B,te=(Y=B.clickable)!=null?Y:Q,ne={center:Z,required:J,clickable:te,borderless:!j};return K&&(ne[K]=!!K),createVNode("div",{class:bem$m(ne),role:te?"button":void 0,tabindex:te?0:void 0,onClick:F},[W(),G(),U(),q(),R.extra==null?void 0:R.extra()])}}}),Cell=withInstall(_Cell);function isEmptyValue(B){return Array.isArray(B)?!B.length:B===0?!1:!B}function runSyncRule(B,R){return!(R.required&&isEmptyValue(B)||R.pattern&&!R.pattern.test(String(B)))}function runRuleValidator(B,R){return new Promise(F=>{var D=R.validator(B,R);if(isPromise(D))return D.then(F);F(D)})}function getRuleMessage(B,R){var{message:F}=R;return isFunction$1(F)?F(B,R):F||""}function startComposing(B){B.target.composing=!0}function endComposing(B){var{target:R}=B;R.composing&&(R.composing=!1,trigger(R,"input"))}function resizeTextarea(B,R){B.style.height="auto";var F=B.scrollHeight;if(isObject$1(R)){var{maxHeight:D,minHeight:G}=R;D!==void 0&&(F=Math.min(F,D)),G!==void 0&&(F=Math.max(F,G))}F&&(B.style.height=F+"px")}function mapInputType(B){return B==="number"?{type:"text",inputmode:"decimal"}:B==="digit"?{type:"tel",inputmode:"numeric"}:{type:B}}var FORM_KEY=Symbol("van-form"),FIELD_KEY=Symbol("van-field");function useLinkField(B){var R=inject(FIELD_KEY,null);R&&!R.childFieldValue.value&&(R.childFieldValue.value=B,watch(B,()=>{R.resetValidation(),R.validateWithTrigger("onChange")}))}var[name$l,bem$l]=createNamespace("field"),fieldProps={formatter:Function,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:[Number,String],inputAlign:String,placeholder:String,errorMessage:String,error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null},clearIcon:{type:String,default:"clear"},modelValue:{type:[Number,String],default:""},clearTrigger:{type:String,default:"focus"},formatTrigger:{type:String,default:"onChange"}},_Field=defineComponent({name:name$l,props:extend$2({},cellProps,fieldProps,{rows:[Number,String],name:String,rules:Array,autosize:[Boolean,Object],labelWidth:[Number,String],labelClass:unknownProp,labelAlign:String,autocomplete:String,showWordLimit:Boolean,errorMessageAlign:String,type:{type:String,default:"text"},colon:{type:Boolean,default:null}}),emits:["blur","focus","clear","keypress","click-input","click-left-icon","click-right-icon","update:modelValue"],setup(B,{emit:R,slots:F}){var D=reactive({focused:!1,validateFailed:!1,validateMessage:""}),G=ref(),U=ref(),{parent:W}=useParent(FORM_KEY),q=()=>{var Ce;return String((Ce=B.modelValue)!=null?Ce:"")},Y=Ce=>{if(isDef$1(B[Ce]))return B[Ce];if(W&&isDef$1(W.props[Ce]))return W.props[Ce]},K=computed(()=>{var Ce=Y("readonly");if(B.clearable&&!Ce){var Te=q()!=="",Se=B.clearTrigger==="always"||B.clearTrigger==="focus"&&D.focused;return Te&&Se}return!1}),Z=computed(()=>U.value&&F.input?U.value():B.modelValue),j=Ce=>Ce.reduce((Te,Se)=>Te.then(()=>{if(!D.validateFailed){var{value:Ne}=Z;if(Se.formatter&&(Ne=Se.formatter(Ne,Se)),!runSyncRule(Ne,Se)){D.validateFailed=!0,D.validateMessage=getRuleMessage(Ne,Se);return}if(Se.validator)return runRuleValidator(Ne,Se).then(Ge=>{Ge&&typeof Ge=="string"?(D.validateFailed=!0,D.validateMessage=Ge):Ge===!1&&(D.validateFailed=!0,D.validateMessage=getRuleMessage(Ne,Se))})}}),Promise.resolve()),Q=()=>{D.validateFailed&&(D.validateFailed=!1,D.validateMessage="")},J=(Ce=B.rules)=>new Promise(Te=>{Q(),Ce?j(Ce).then(()=>{D.validateFailed?Te({name:B.name,message:D.validateMessage}):Te()}):Te()}),te=Ce=>{if(W&&B.rules){var Te=W.props.validateTrigger===Ce,Se=B.rules.filter(Ne=>Ne.trigger?Ne.trigger===Ce:Te);Se.length&&J(Se)}},ne=Ce=>{var{maxlength:Te}=B;if(isDef$1(Te)&&Ce.length>Te){var Se=q();return Se&&Se.length===+Te?Se:Ce.slice(0,+Te)}return Ce},ie=(Ce,Te="onChange")=>{if(Ce=ne(Ce),B.type==="number"||B.type==="digit"){var Se=B.type==="number";Ce=formatNumber(Ce,Se,Se)}B.formatter&&Te===B.formatTrigger&&(Ce=B.formatter(Ce)),G.value&&G.value.value!==Ce&&(G.value.value=Ce),Ce!==B.modelValue&&R("update:modelValue",Ce)},re=Ce=>{Ce.target.composing||ie(Ce.target.value)},oe=()=>{var Ce;return(Ce=G.value)==null?void 0:Ce.blur()},le=()=>{var Ce;return(Ce=G.value)==null?void 0:Ce.focus()},fe=Ce=>{D.focused=!0,R("focus",Ce);var Te=Y("readonly");Te&&oe()},he=Ce=>{D.focused=!1,ie(q(),"onBlur"),R("blur",Ce),te("onBlur"),resetScroll()},ge=Ce=>R("click-input",Ce),ce=Ce=>R("click-left-icon",Ce),me=Ce=>R("click-right-icon",Ce),ye=Ce=>{preventDefault(Ce),R("update:modelValue",""),R("clear",Ce)},ve=computed(()=>{if(typeof B.error=="boolean")return B.error;if(W&&W.props.showError&&D.validateFailed)return!0}),pe=computed(()=>{var Ce=Y("labelWidth");if(Ce)return{width:addUnit(Ce)}}),be=Ce=>{var Te=13;if(Ce.keyCode===Te){var Se=W&&W.props.submitOnEnter;!Se&&B.type!=="textarea"&&preventDefault(Ce),B.type==="search"&&oe()}R("keypress",Ce)},xe=()=>{var Ce=G.value;B.type==="textarea"&&B.autosize&&Ce&&resizeTextarea(Ce,B.autosize)},ue=()=>{var Ce=Y("inputAlign");if(F.input)return createVNode("div",{class:bem$l("control",[Ce,"custom"]),onClick:ge},[F.input()]);var Te={ref:G,name:B.name,rows:B.rows!==void 0?+B.rows:void 0,class:bem$l("control",Ce),value:B.modelValue,disabled:Y("disabled"),readonly:Y("readonly"),autofocus:B.autofocus,placeholder:B.placeholder,autocomplete:B.autocomplete,onBlur:he,onFocus:fe,onInput:re,onClick:ge,onChange:endComposing,onKeypress:be,onCompositionend:endComposing,onCompositionstart:startComposing};return B.type==="textarea"?createVNode("textarea",Te,null):createVNode("input",mergeProps(mapInputType(B.type),Te),null)},_e=()=>{var Ce=F["left-icon"];if(B.leftIcon||Ce)return createVNode("div",{class:bem$l("left-icon"),onClick:ce},[Ce?Ce():createVNode(Icon,{name:B.leftIcon,classPrefix:B.iconPrefix},null)])},Be=()=>{var Ce=F["right-icon"];if(B.rightIcon||Ce)return createVNode("div",{class:bem$l("right-icon"),onClick:me},[Ce?Ce():createVNode(Icon,{name:B.rightIcon,classPrefix:B.iconPrefix},null)])},Ae=()=>{if(B.showWordLimit&&B.maxlength){var Ce=q().length;return createVNode("div",{class:bem$l("word-limit")},[createVNode("span",{class:bem$l("word-num")},[Ce]),createTextVNode("/"),B.maxlength])}},Pe=()=>{if(!(W&&W.props.showErrorMessage===!1)){var Ce=B.errorMessage||D.validateMessage;if(Ce){var Te=Y("errorMessageAlign");return createVNode("div",{class:bem$l("error-message",Te)},[Ce])}}},Ie=()=>{var Ce=Y("colon")?":":"";if(F.label)return[F.label(),Ce];if(B.label)return createVNode("span",null,[B.label+Ce])};return useExpose({blur:oe,focus:le,validate:J,formValue:Z,resetValidation:Q}),provide(FIELD_KEY,{childFieldValue:U,resetValidation:Q,validateWithTrigger:te}),watch(()=>B.modelValue,()=>{ie(q()),Q(),te("onChange"),nextTick(xe)}),onMounted(()=>{ie(q(),B.formatTrigger),nextTick(xe)}),()=>{var Ce=Y("disabled"),Te=Y("labelAlign"),Se=Ie(),Ne=_e();return createVNode(Cell,{size:B.size,icon:B.leftIcon,class:bem$l({error:ve.value,disabled:Ce,["label-"+Te]:Te,"min-height":B.type==="textarea"&&!B.autosize}),center:B.center,border:B.border,isLink:B.isLink,required:B.required,clickable:B.clickable,titleStyle:pe.value,valueClass:bem$l("value"),titleClass:[bem$l("label",Te),B.labelClass],arrowDirection:B.arrowDirection},{default:()=>[createVNode("div",{class:bem$l("body")},[ue(),K.value&&createVNode(Icon,{name:B.clearIcon,class:bem$l("clear"),onTouchstart:ye},null),Be(),F.button&&createVNode("div",{class:bem$l("button")},[F.button()])]),Ae(),Pe()],icon:Ne?()=>Ne:null,title:Se?()=>Se:null,extra:F.extra})}}}),Field=withInstall(_Field);function usePopupState(){var B=reactive({show:!1}),R=G=>{B.show=G},F=G=>{extend$2(B,G),nextTick(()=>R(!0))},D=()=>R(!1);return useExpose({open:F,close:D,toggle:R}),{open:F,close:D,state:B,toggle:R}}function mountComponent(B){var R=createApp(B),F=document.createElement("div");return document.body.appendChild(F),{instance:R.mount(F),unmount(){R.unmount(),document.body.removeChild(F)}}}var lockCount=0;function lockClick(B){B?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(lockCount--,lockCount||document.body.classList.remove("van-toast--unclickable"))}var[name$k,bem$k]=createNamespace("toast"),VanToast=defineComponent({name:name$k,props:{icon:String,show:Boolean,overlay:Boolean,message:[Number,String],iconSize:[Number,String],className:unknownProp,iconPrefix:String,loadingType:String,forbidClick:Boolean,overlayClass:unknownProp,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,type:{type:String,default:"text"},duration:{type:Number,default:2e3},position:{type:String,default:"middle"},transition:{type:String,default:"van-fade"}},emits:["update:show"],setup(B,{emit:R}){var F,D=!1,G=()=>{var Z=B.show&&B.forbidClick;D!==Z&&(D=Z,lockClick(D))},U=Z=>R("update:show",Z),W=()=>{B.closeOnClick&&U(!1)},q=()=>{clearTimeout(F)},Y=()=>{var{icon:Z,type:j,iconSize:Q,iconPrefix:J,loadingType:te}=B,ne=Z||j==="success"||j==="fail";if(ne)return createVNode(Icon,{name:Z||j,size:Q,class:bem$k("icon"),classPrefix:J},null);if(j==="loading")return createVNode(Loading,{class:bem$k("loading"),size:Q,type:te},null)},K=()=>{var{type:Z,message:j}=B;if(isDef$1(j)&&j!=="")return Z==="html"?createVNode("div",{class:bem$k("text"),innerHTML:String(j)},null):createVNode("div",{class:bem$k("text")},[j])};return watch(()=>[B.show,B.forbidClick],G),watch(()=>[B.show,B.type,B.message,B.duration],()=>{q(),B.show&&B.duration>0&&(F=setTimeout(()=>{U(!1)},B.duration))}),onMounted(G),onUnmounted(G),()=>createVNode(Popup,mergeProps({show:B.show,class:[bem$k([B.position,{[B.type]:!B.icon}]),B.className],overlay:B.overlay,lockScroll:!1,transition:B.transition,overlayClass:B.overlayClass,overlayStyle:B.overlayStyle,closeOnClickOverlay:B.closeOnClickOverlay,onClick:W,onClosed:q},{"onUpdate:show":U}),{default:()=>[Y(),K()]})}}),defaultOptions={icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1},queue$1=[],allowMultiple=!1,currentOptions=extend$2({},defaultOptions),defaultOptionsMap={};function parseOptions(B){return isObject$1(B)?B:{message:B}}function createInstance(){var{instance:B,unmount:R}=mountComponent({setup(){var F=ref(""),{open:D,state:G,close:U,toggle:W}=usePopupState(),q=()=>{allowMultiple&&(queue$1=queue$1.filter(K=>K!==B),R())},Y=()=>{var K={onClosed:q,"onUpdate:show":W};return F.value&&(K.message=F.value),createVNode(VanToast,mergeProps(G,K),null)};return getCurrentInstance().render=Y,{open:D,clear:U,message:F}}});return B}function getInstance(){if(!queue$1.length||allowMultiple){var B=createInstance();queue$1.push(B)}return queue$1[queue$1.length-1]}function Toast(B={}){if(!inBrowser$1)return{};var R=getInstance(),F=parseOptions(B);return R.open(extend$2({},currentOptions,defaultOptionsMap[F.type||currentOptions.type],F)),R}var createMethod=B=>R=>Toast(extend$2({type:B},parseOptions(R)));Toast.loading=createMethod("loading");Toast.success=createMethod("success");Toast.fail=createMethod("fail");Toast.clear=B=>{queue$1.length&&(B?(queue$1.forEach(R=>{R.clear()}),queue$1=[]):allowMultiple?queue$1.shift().clear():queue$1[0].clear())};function setDefaultOptions(B,R){typeof B=="string"?defaultOptionsMap[B]=R:extend$2(currentOptions,B)}Toast.setDefaultOptions=setDefaultOptions;Toast.resetDefaultOptions=B=>{typeof B=="string"?defaultOptionsMap[B]=null:(currentOptions=extend$2({},defaultOptions),defaultOptionsMap={})};Toast.allowMultiple=(B=!0)=>{allowMultiple=B};Toast.install=B=>{B.use(withInstall(VanToast)),B.config.globalProperties.$toast=Toast};function callInterceptor(B){var{interceptor:R,args:F,done:D,canceled:G}=B;if(R){var U=R.apply(null,F||[]);isPromise(U)?U.then(W=>{W?D():G&&G()}).catch(noop$2):U?D():G&&G()}else D()}var[name$j,bem$j,t$1]=createNamespace("dialog"),popupKeys=[...popupSharedPropKeys,"transition","closeOnPopstate"],VanDialog=defineComponent({name:name$j,props:extend$2({},popupSharedProps,{title:String,theme:String,width:[Number,String],message:[String,Function],callback:Function,allowHtml:Boolean,className:unknownProp,beforeClose:Function,messageAlign:String,closeOnPopstate:truthProp,showCancelButton:Boolean,cancelButtonText:String,cancelButtonColor:String,confirmButtonText:String,confirmButtonColor:String,showConfirmButton:truthProp,closeOnClickOverlay:Boolean,transition:{type:String,default:"van-dialog-bounce"}}),emits:["confirm","cancel","update:show"],setup(B,{emit:R,slots:F}){var D=reactive({confirm:!1,cancel:!1}),G=ne=>R("update:show",ne),U=ne=>{G(!1),B.callback&&B.callback(ne)},W=ne=>()=>{!B.show||(R(ne),B.beforeClose?(D[ne]=!0,callInterceptor({interceptor:B.beforeClose,args:[ne],done(){U(ne),D[ne]=!1},canceled(){D[ne]=!1}})):U(ne))},q=W("cancel"),Y=W("confirm"),K=()=>{var ne=F.title?F.title():B.title;if(ne)return createVNode("div",{class:bem$j("header",{isolated:!B.message&&!F.default})},[ne])},Z=ne=>{var{message:ie,allowHtml:re,messageAlign:oe}=B,le=bem$j("message",{"has-title":ne,[oe]:oe}),fe=isFunction$1(ie)?ie():ie;return re&&typeof fe=="string"?createVNode("div",{class:le,innerHTML:fe},null):createVNode("div",{class:le},[fe])},j=()=>{if(F.default)return createVNode("div",{class:bem$j("content")},[F.default()]);var{title:ne,message:ie,allowHtml:re}=B;if(ie){var oe=!!(ne||F.title);return createVNode("div",{key:re?1:0,class:bem$j("content",{isolated:!oe})},[Z(oe)])}},Q=()=>createVNode("div",{class:[BORDER_TOP,bem$j("footer")]},[B.showCancelButton&&createVNode(Button,{size:"large",text:B.cancelButtonText||t$1("cancel"),class:bem$j("cancel"),style:{color:B.cancelButtonColor},loading:D.cancel,onClick:q},null),B.showConfirmButton&&createVNode(Button,{size:"large",text:B.confirmButtonText||t$1("confirm"),class:[bem$j("confirm"),{[BORDER_LEFT]:B.showCancelButton}],style:{color:B.confirmButtonColor},loading:D.confirm,onClick:Y},null)]),J=()=>createVNode(ActionBar,{class:bem$j("footer")},{default:()=>[B.showCancelButton&&createVNode(ActionBarButton,{type:"warning",text:B.cancelButtonText||t$1("cancel"),class:bem$j("cancel"),color:B.cancelButtonColor,loading:D.cancel,onClick:q},null),B.showConfirmButton&&createVNode(ActionBarButton,{type:"danger",text:B.confirmButtonText||t$1("confirm"),class:bem$j("confirm"),color:B.confirmButtonColor,loading:D.confirm,onClick:Y},null)]}),te=()=>F.footer?F.footer():B.theme==="round-button"?J():Q();return()=>{var{width:ne,title:ie,theme:re,message:oe,className:le}=B;return createVNode(Popup,mergeProps({role:"dialog",class:[bem$j([re]),le],style:{width:addUnit(ne)},"aria-labelledby":ie||oe},pick(B,popupKeys),{"onUpdate:show":G}),{default:()=>[K(),j(),te()]})}}}),instance;function initInstance(){var B={setup(){var{state:R,toggle:F}=usePopupState();return()=>createVNode(VanDialog,mergeProps(R,{"onUpdate:show":F}),null)}};({instance}=mountComponent(B))}function Dialog(B){return inBrowser$1?new Promise((R,F)=>{instance||initInstance(),instance.open(extend$2({},Dialog.currentOptions,B,{callback:D=>{(D==="confirm"?R:F)(D)}}))}):Promise.resolve()}Dialog.defaultOptions={title:"",width:"",theme:null,message:"",overlay:!0,callback:null,teleport:"body",className:"",allowHtml:!1,lockScroll:!0,transition:"van-dialog-bounce",beforeClose:null,overlayClass:"",overlayStyle:void 0,messageAlign:"",cancelButtonText:"",cancelButtonColor:null,confirmButtonText:"",confirmButtonColor:null,showConfirmButton:!0,showCancelButton:!1,closeOnPopstate:!0,closeOnClickOverlay:!1};Dialog.currentOptions=extend$2({},Dialog.defaultOptions);Dialog.alert=Dialog;Dialog.confirm=B=>Dialog(extend$2({showCancelButton:!0},B));Dialog.close=()=>{instance&&instance.toggle(!1)};Dialog.setDefaultOptions=B=>{extend$2(Dialog.currentOptions,B)};Dialog.resetDefaultOptions=()=>{Dialog.currentOptions=extend$2({},Dialog.defaultOptions)};Dialog.install=B=>{B.use(withInstall(VanDialog)),B.config.globalProperties.$dialog=Dialog};Dialog.Component=withInstall(VanDialog);var[name$i,bem$i]=createNamespace("switch"),_Switch=defineComponent({name:name$i,props:{size:[Number,String],loading:Boolean,disabled:Boolean,modelValue:unknownProp,activeColor:String,inactiveColor:String,activeValue:{type:unknownProp,default:!0},inactiveValue:{type:unknownProp,default:!1}},emits:["change","update:modelValue"],setup(B,{emit:R}){var F=()=>B.modelValue===B.activeValue,D=()=>{if(!B.disabled&&!B.loading){var U=F()?B.inactiveValue:B.activeValue;R("update:modelValue",U),R("change",U)}},G=()=>{if(B.loading){var U=F()?B.activeColor:B.inactiveColor;return createVNode(Loading,{class:bem$i("loading"),color:U},null)}};return useLinkField(()=>B.modelValue),()=>{var{size:U,loading:W,disabled:q,activeColor:Y,inactiveColor:K}=B,Z=F(),j={fontSize:addUnit(U),backgroundColor:Z?Y:K};return createVNode("div",{role:"switch",class:bem$i({on:Z,loading:W,disabled:q}),style:j,"aria-checked":Z,onClick:D},[createVNode("div",{class:bem$i("node")},[G()])])}}}),Switch=withInstall(_Switch),[name$h,bem$h]=createNamespace("radio-group"),RADIO_KEY=Symbol(name$h),props$4={disabled:Boolean,iconSize:[Number,String],direction:String,modelValue:unknownProp,checkedColor:String},_RadioGroup=defineComponent({name:name$h,props:props$4,emits:["change","update:modelValue"],setup(B,{emit:R,slots:F}){var{linkChildren:D}=useChildren(RADIO_KEY),G=U=>R("update:modelValue",U);return watch(()=>B.modelValue,U=>R("change",U)),D({props:B,updateValue:G}),useLinkField(()=>B.modelValue),()=>createVNode("div",{class:bem$h([B.direction]),role:"radiogroup"},[F.default==null?void 0:F.default()])}}),RadioGroup=withInstall(_RadioGroup),checkerProps={name:unknownProp,disabled:Boolean,iconSize:[Number,String],modelValue:unknownProp,checkedColor:String,labelPosition:String,labelDisabled:Boolean,shape:{type:String,default:"round"}},Checker=defineComponent({props:extend$2({},checkerProps,{role:String,parent:Object,checked:Boolean,bindGroup:truthProp,bem:{type:Function,required:!0}}),emits:["click","toggle"],setup(B,{emit:R,slots:F}){var D=ref(),G=j=>{if(B.parent&&B.bindGroup)return B.parent.props[j]},U=computed(()=>G("disabled")||B.disabled),W=computed(()=>G("direction")),q=computed(()=>{var j=B.checkedColor||G("checkedColor");if(j&&B.checked&&!U.value)return{borderColor:j,backgroundColor:j}}),Y=j=>{var{target:Q}=j,J=D.value,te=J===Q||J.contains(Q);!U.value&&(te||!B.labelDisabled)&&R("toggle"),R("click",j)},K=()=>{var{bem:j,shape:Q,checked:J}=B,te=B.iconSize||G("iconSize");return createVNode("div",{ref:D,class:j("icon",[Q,{disabled:U.value,checked:J}]),style:{fontSize:addUnit(te)}},[F.icon?F.icon({checked:J,disabled:U.value}):createVNode(Icon,{name:"success",style:q.value},null)])},Z=()=>{if(F.default)return createVNode("span",{class:B.bem("label",[B.labelPosition,{disabled:U.value}])},[F.default()])};return()=>{var j=[K()];return B.labelPosition==="left"?j.unshift(Z()):j.push(Z()),createVNode("div",{role:B.role,class:B.bem([{disabled:U.value,"label-disabled":B.labelDisabled},W.value]),tabindex:U.value?-1:0,"aria-checked":B.checked,onClick:Y},[j])}}}),[name$g,bem$g]=createNamespace("radio"),_Radio=defineComponent({name:name$g,props:checkerProps,emits:["update:modelValue"],setup(B,{emit:R,slots:F}){var{parent:D}=useParent(RADIO_KEY),G=()=>{var W=D?D.props.modelValue:B.modelValue;return W===B.name},U=()=>{D?D.updateValue(B.name):R("update:modelValue",B.name)};return()=>createVNode(Checker,mergeProps({bem:bem$g,role:"radio",parent:D,checked:G(),onToggle:U},B),pick(F,["default","icon"]))}}),Radio=withInstall(_Radio);function useRefs(){var B=ref([]);onBeforeUpdate(()=>{B.value=[]});var R=F=>D=>{B.value[F]=D};return[B,R]}var rafId;function scrollLeftTo(B,R,F){cancelRaf(rafId);var D=0,G=B.scrollLeft,U=F===0?1:Math.round(F*1e3/16);function W(){B.scrollLeft+=(R-G)/U,++DR||!U&&GR?raf$2(Y):D&&raf$2(D)}Y()}function useVisibilityChange(B,R){if(!(!inBrowser$1||!window.IntersectionObserver)){var F=new IntersectionObserver(U=>{R(U[0].intersectionRatio>0)},{root:document.body}),D=()=>{B.value&&F.observe(B.value)},G=()=>{B.value&&F.unobserve(B.value)};onDeactivated(G),onBeforeUnmount(G),onMountedOrActivated(D)}}var[name$f,bem$f]=createNamespace("sticky"),_Sticky=defineComponent({name:name$f,props:{zIndex:[Number,String],container:Object,offsetTop:{type:[Number,String],default:0},offsetBottom:{type:[Number,String],default:0},position:{type:String,default:"top"}},emits:["scroll","change"],setup(B,{emit:R,slots:F}){var D=ref(),G=useScrollParent(D),U=reactive({fixed:!1,width:0,height:0,transform:0}),W=computed(()=>unitToPx(B.position==="top"?B.offsetTop:B.offsetBottom)),q=computed(()=>{var{fixed:j,height:Q,width:J}=U;if(j)return{width:J+"px",height:Q+"px"}}),Y=computed(()=>{if(!!U.fixed){var j=extend$2(getZIndexStyle(B.zIndex),{width:U.width+"px",height:U.height+"px",[B.position]:W.value+"px"});return U.transform&&(j.transform="translate3d(0, "+U.transform+"px, 0)"),j}}),K=j=>R("scroll",{scrollTop:j,isFixed:U.fixed}),Z=()=>{if(!(!D.value||isHidden(D))){var{container:j,position:Q}=B,J=useRect(D),te=getScrollTop(window);if(U.width=J.width,U.height=J.height,Q==="top")if(j){var ne=useRect(j),ie=ne.bottom-W.value-U.height;U.fixed=W.value>J.top&&ne.bottom>0,U.transform=ie<0?ie:0}else U.fixed=W.value>J.top;else{var{clientHeight:re}=document.documentElement;if(j){var oe=useRect(j),le=re-oe.top-W.value-U.height;U.fixed=re-W.valueoe.top,U.transform=le<0?-le:0}else U.fixed=re-W.valueU.fixed,j=>R("change",j)),useEventListener("scroll",Z,{target:G}),useVisibilityChange(D,Z),()=>createVNode("div",{ref:D,style:q.value},[createVNode("div",{class:bem$f({fixed:U.fixed}),style:Y.value},[F.default==null?void 0:F.default()])])}}),Sticky=withInstall(_Sticky),[name$e,bem$e]=createNamespace("tab"),TabsTitle=defineComponent({name:name$e,props:{dot:Boolean,type:String,color:String,title:String,badge:[Number,String],isActive:Boolean,disabled:Boolean,scrollable:Boolean,activeColor:String,renderTitle:Function,inactiveColor:String},setup(B){var R=computed(()=>{var D={},{type:G,color:U,disabled:W,isActive:q,activeColor:Y,inactiveColor:K}=B,Z=G==="card";U&&Z&&(D.borderColor=U,W||(q?D.backgroundColor=U:D.color=U));var j=q?Y:K;return j&&(D.color=j),D}),F=()=>{var D=createVNode("span",{class:bem$e("text",{ellipsis:!B.scrollable})},[B.renderTitle?B.renderTitle():B.title]);return B.dot||isDef$1(B.badge)&&B.badge!==""?createVNode(Badge,{dot:B.dot,content:B.badge},{default:()=>[D]}):D};return()=>createVNode("div",{role:"tab",class:[bem$e({active:B.isActive,disabled:B.disabled})],style:R.value,"aria-selected":B.isActive},[F()])}}),[name$d,bem$d]=createNamespace("swipe"),SWIPE_KEY=Symbol(name$d),props$3={loop:truthProp,width:[Number,String],height:[Number,String],vertical:Boolean,touchable:truthProp,lazyRender:Boolean,indicatorColor:String,showIndicators:truthProp,stopPropagation:truthProp,autoplay:{type:[Number,String],default:0},duration:{type:[Number,String],default:500},initialSwipe:{type:[Number,String],default:0}},_Swipe=defineComponent({name:name$d,props:props$3,emits:["change"],setup(B,{emit:R,slots:F}){var D=ref(),G=reactive({rect:null,width:0,height:0,offset:0,active:0,swiping:!1}),U=useTouch(),W=useWindowSize(),{children:q,linkChildren:Y}=useChildren(SWIPE_KEY),K=computed(()=>q.length),Z=computed(()=>G[B.vertical?"height":"width"]),j=computed(()=>B.vertical?U.deltaY.value:U.deltaX.value),Q=computed(()=>{if(G.rect){var Ce=B.vertical?G.rect.height:G.rect.width;return Ce-Z.value*K.value}return 0}),J=computed(()=>Math.ceil(Math.abs(Q.value)/Z.value)),te=computed(()=>K.value*Z.value),ne=computed(()=>(G.active+K.value)%K.value),ie=computed(()=>{var Ce=B.vertical?"vertical":"horizontal";return U.direction.value===Ce}),re=computed(()=>{var Ce={transitionDuration:(G.swiping?0:B.duration)+"ms",transform:"translate"+(B.vertical?"Y":"X")+"("+G.offset+"px)"};if(Z.value){var Te=B.vertical?"height":"width",Se=B.vertical?"width":"height";Ce[Te]=te.value+"px",Ce[Se]=B[Se]?B[Se]+"px":""}return Ce}),oe=Ce=>{var{active:Te}=G;return Ce?B.loop?clamp(Te+Ce,-1,K.value):clamp(Te+Ce,0,J.value):Te},le=(Ce,Te=0)=>{var Se=Ce*Z.value;B.loop||(Se=Math.min(Se,-Q.value));var Ne=Te-Se;return B.loop||(Ne=clamp(Ne,Q.value,0)),Ne},fe=({pace:Ce=0,offset:Te=0,emitChange:Se})=>{if(!(K.value<=1)){var{active:Ne}=G,Ge=oe(Ce),ke=le(Ge,Te);if(B.loop){if(q[0]&&ke!==Q.value){var $e=ke0;q[K.value-1].setOffset(We?-te.value:0)}}G.active=Ge,G.offset=ke,Se&&Ge!==Ne&&R("change",ne.value)}},he=()=>{G.swiping=!0,G.active<=-1?fe({pace:K.value}):G.active>=K.value&&fe({pace:-K.value})},ge=()=>{he(),U.reset(),doubleRaf(()=>{G.swiping=!1,fe({pace:-1,emitChange:!0})})},ce=()=>{he(),U.reset(),doubleRaf(()=>{G.swiping=!1,fe({pace:1,emitChange:!0})})},me,ye=()=>clearTimeout(me),ve=()=>{ye(),B.autoplay>0&&K.value>1&&(me=setTimeout(()=>{ce(),ve()},+B.autoplay))},pe=(Ce=+B.initialSwipe)=>{if(!!D.value){if(!isHidden(D)){var Te,Se,Ne={width:D.value.offsetWidth,height:D.value.offsetHeight};G.rect=Ne,G.width=+((Te=B.width)!=null?Te:Ne.width),G.height=+((Se=B.height)!=null?Se:Ne.height)}K.value&&(Ce=Math.min(K.value-1,Ce)),G.active=Ce,G.swiping=!0,G.offset=le(Ce),q.forEach(Ge=>{Ge.setOffset(0)})}},be=()=>pe(G.active),xe,ue=Ce=>{!B.touchable||(U.start(Ce),xe=Date.now(),ye(),he())},_e=Ce=>{B.touchable&&G.swiping&&(U.move(Ce),ie.value&&(preventDefault(Ce,B.stopPropagation),fe({offset:j.value})))},Be=()=>{if(!(!B.touchable||!G.swiping)){var Ce=Date.now()-xe,Te=j.value/Ce,Se=Math.abs(Te)>.25||Math.abs(j.value)>Z.value/2;if(Se&&ie.value){var Ne=B.vertical?U.offsetY.value:U.offsetX.value,Ge=0;B.loop?Ge=Ne>0?j.value>0?-1:1:0:Ge=-Math[j.value>0?"ceil":"floor"](j.value/Z.value),fe({pace:Ge,emitChange:!0})}else j.value&&fe({pace:0});G.swiping=!1,ve()}},Ae=(Ce,Te={})=>{he(),U.reset(),doubleRaf(()=>{var Se;B.loop&&Ce===K.value?Se=G.active===0?0:Ce:Se=Ce%K.value,Te.immediate?doubleRaf(()=>{G.swiping=!1}):G.swiping=!1,fe({pace:Se-G.active,emitChange:!0})})},Pe=(Ce,Te)=>{var Se=Te===ne.value,Ne=Se?{backgroundColor:B.indicatorColor}:void 0;return createVNode("i",{style:Ne,class:bem$d("indicator",{active:Se})},null)},Ie=()=>{if(F.indicator)return F.indicator({active:ne.value});if(B.showIndicators&&K.value>1)return createVNode("div",{class:bem$d("indicators",{vertical:B.vertical})},[Array(K.value).fill("").map(Pe)])};return useExpose({prev:ge,next:ce,state:G,resize:be,swipeTo:Ae}),Y({size:Z,props:B,count:K,activeIndicator:ne}),watch(()=>B.initialSwipe,Ce=>pe(+Ce)),watch(K,()=>pe(G.active)),watch([K,()=>B.autoplay],ve),watch([W.width,W.height],be),watch(usePageVisibility(),Ce=>{Ce==="visible"?ve():ye()}),onMounted(pe),onActivated(()=>pe(G.active)),onPopupReopen(()=>pe(G.active)),onDeactivated(ye),onBeforeUnmount(ye),()=>createVNode("div",{ref:D,class:bem$d()},[createVNode("div",{style:re.value,class:bem$d("track",{vertical:B.vertical}),onTouchstart:ue,onTouchmove:_e,onTouchend:Be,onTouchcancel:Be},[F.default==null?void 0:F.default()]),Ie()])}}),Swipe=withInstall(_Swipe),[name$c,bem$c]=createNamespace("tabs"),TabsContent=defineComponent({name:name$c,props:{inited:Boolean,animated:Boolean,swipeable:Boolean,lazyRender:Boolean,count:{type:Number,required:!0},duration:{type:[Number,String],required:!0},currentIndex:{type:Number,required:!0}},emits:["change"],setup(B,{emit:R,slots:F}){var D=ref(),G=q=>R("change",q),U=()=>{var q=F.default==null?void 0:F.default();return B.animated||B.swipeable?createVNode(Swipe,{ref:D,loop:!1,class:bem$c("track"),duration:+B.duration*1e3,touchable:B.swipeable,lazyRender:B.lazyRender,showIndicators:!1,onChange:G},{default:()=>[q]}):q},W=q=>{var Y=D.value;Y&&Y.state.active!==q&&Y.swipeTo(q,{immediate:!B.inited})};return watch(()=>B.currentIndex,W),onMounted(()=>{W(B.currentIndex)}),()=>createVNode("div",{class:bem$c("content",{animated:B.animated||B.swipeable})},[U()])}}),[name$b,bem$b]=createNamespace("tabs"),TABS_KEY=Symbol(name$b),props$2={color:String,border:Boolean,sticky:Boolean,animated:Boolean,ellipsis:truthProp,swipeable:Boolean,scrollspy:Boolean,background:String,lazyRender:truthProp,lineWidth:[Number,String],lineHeight:[Number,String],beforeChange:Function,titleActiveColor:String,titleInactiveColor:String,type:{type:String,default:"line"},active:{type:[Number,String],default:0},duration:{type:[Number,String],default:.3},offsetTop:{type:[Number,String],default:0},swipeThreshold:{type:[Number,String],default:5}},_Tabs=defineComponent({name:name$b,props:props$2,emits:["click","change","scroll","disabled","rendered","update:active"],setup(B,{emit:R,slots:F}){var D,G,U,W=ref(),q=ref(),Y=ref(),K=useWindowSize(),Z=useScrollParent(W),[j,Q]=useRefs(),{children:J,linkChildren:te}=useChildren(TABS_KEY),ne=reactive({inited:!1,position:"",lineStyle:{},currentIndex:-1}),ie=computed(()=>J.length>B.swipeThreshold||!B.ellipsis),re=computed(()=>({borderColor:B.color,background:B.background})),oe=(Te,Se)=>{var Ne;return(Ne=Te.name)!=null?Ne:Se},le=computed(()=>{var Te=J[ne.currentIndex];if(Te)return oe(Te,ne.currentIndex)}),fe=computed(()=>unitToPx(B.offsetTop)),he=computed(()=>B.sticky?fe.value+D:0),ge=Te=>{var Se=q.value,Ne=j.value;if(!(!ie.value||!Se||!Ne||!Ne[ne.currentIndex])){var Ge=Ne[ne.currentIndex].$el,ke=Ge.offsetLeft-(Se.offsetWidth-Ge.offsetWidth)/2;scrollLeftTo(Se,ke,Te?0:+B.duration)}},ce=()=>{var Te=ne.inited;nextTick(()=>{var Se=j.value;if(!(!Se||!Se[ne.currentIndex]||B.type!=="line"||isHidden(W.value))){var Ne=Se[ne.currentIndex].$el,{lineWidth:Ge,lineHeight:ke}=B,$e=Ne.offsetLeft+Ne.offsetWidth/2,We={width:addUnit(Ge),backgroundColor:B.color,transform:"translateX("+$e+"px) translateX(-50%)"};if(Te&&(We.transitionDuration=B.duration+"s"),isDef$1(ke)){var Ve=addUnit(ke);We.height=Ve,We.borderRadius=Ve}ne.lineStyle=We}})},me=Te=>{for(var Se=Te=0&&Te{var Se=me(Te);if(!!isDef$1(Se)){var Ne=J[Se],Ge=oe(Ne,Se),ke=ne.currentIndex!==null;ne.currentIndex=Se,Ge!==B.active&&(R("update:active",Ge),ke&&R("change",Ge,Ne.title))}},ve=Te=>{var Se=J.find((Ge,ke)=>oe(Ge,ke)===Te),Ne=Se?J.indexOf(Se):0;ye(Ne)},pe=(Te=!1)=>{if(B.scrollspy){var Se=J[ne.currentIndex].$el;if(Se&&Z.value){var Ne=getElementTop(Se,Z.value)-he.value;G=!0,scrollTopTo(Z.value,Ne,Te?0:+B.duration,()=>{G=!1})}}},be=(Te,Se)=>{var{title:Ne,disabled:Ge}=J[Se],ke=oe(J[Se],Se);Ge?R("disabled",ke,Ne):(callInterceptor({interceptor:B.beforeChange,args:[ke],done:()=>{ye(Se),pe()}}),R("click",ke,Ne),route(Te))},xe=Te=>{U=Te.isFixed,R("scroll",Te)},ue=Te=>{nextTick(()=>{ve(Te),pe(!0)})},_e=()=>{for(var Te=0;Tehe.value)return Te===0?0:Te-1}return J.length-1},Be=()=>{if(B.scrollspy&&!G){var Te=_e();ye(Te)}},Ae=()=>J.map((Te,Se)=>createVNode(TabsTitle,{ref:Q(Se),dot:Te.dot,type:B.type,badge:Te.badge,title:Te.title,color:B.color,style:Te.titleStyle,class:Te.titleClass,isActive:Se===ne.currentIndex,disabled:Te.disabled,scrollable:ie.value,renderTitle:Te.$slots.title,activeColor:B.titleActiveColor,inactiveColor:B.titleInactiveColor,onClick:()=>{be(Te,Se)}},null)),Pe=()=>{var Te,Se,{type:Ne,border:Ge}=B;return createVNode("div",{ref:Y,class:[bem$b("wrap",{scrollable:ie.value}),{[BORDER_TOP_BOTTOM]:Ne==="line"&&Ge}]},[createVNode("div",{ref:q,role:"tablist",class:bem$b("nav",[Ne,{complete:ie.value}]),style:re.value},[(Te=F["nav-left"])==null?void 0:Te.call(F),Ae(),Ne==="line"&&createVNode("div",{class:bem$b("line"),style:ne.lineStyle},null),(Se=F["nav-right"])==null?void 0:Se.call(F)])])};watch([()=>B.color,K.width],ce),watch(()=>B.active,Te=>{Te!==le.value&&ve(Te)}),watch(()=>J.length,()=>{ne.inited&&(ve(B.active),ce(),nextTick(()=>{ge(!0)}))}),watch(()=>ne.currentIndex,()=>{ge(),ce(),U&&!B.scrollspy&&setRootScrollTop(Math.ceil(getElementTop(W.value)-fe.value))});var Ie=()=>{ve(B.active),nextTick(()=>{ne.inited=!0,D=getVisibleHeight(Y.value),ge(!0)})},Ce=(Te,Se)=>R("rendered",Te,Se);return useExpose({resize:ce,scrollTo:ue}),onActivated(ce),onPopupReopen(ce),onMountedOrActivated(Ie),useEventListener("scroll",Be,{target:Z}),te({props:B,setLine:ce,onRendered:Ce,currentName:le,scrollIntoView:ge}),()=>createVNode("div",{ref:W,class:bem$b([B.type])},[B.sticky?createVNode(Sticky,{container:W.value,offsetTop:fe.value,onScroll:xe},{default:()=>[Pe()]}):Pe(),createVNode(TabsContent,{count:J.length,inited:ne.inited,animated:B.animated,duration:B.duration,swipeable:B.swipeable,lazyRender:B.lazyRender,currentIndex:ne.currentIndex,onChange:ye},{default:()=>[F.default==null?void 0:F.default()]})])}}),TAB_STATUS_KEY=Symbol();function useTabStatus(){return inject(TAB_STATUS_KEY,null)}var[name$a,bem$a]=createNamespace("swipe-item"),_SwipeItem=defineComponent({name:name$a,setup(B,{slots:R}){var F,D=reactive({offset:0,inited:!1,mounted:!1}),{parent:G,index:U}=useParent(SWIPE_KEY);if(!!G){var W=computed(()=>{var K={},{vertical:Z}=G.props;return G.size.value&&(K[Z?"height":"width"]=G.size.value+"px"),D.offset&&(K.transform="translate"+(Z?"Y":"X")+"("+D.offset+"px)"),K}),q=computed(()=>{var{loop:K,lazyRender:Z}=G.props;if(!Z||F)return!0;if(!D.mounted)return!1;var j=G.activeIndicator.value,Q=G.count.value-1,J=j===0&&K?Q:j-1,te=j===Q&&K?0:j+1;return F=U.value===j||U.value===J||U.value===te,F}),Y=K=>{D.offset=K};return onMounted(()=>{nextTick(()=>{D.mounted=!0})}),useExpose({setOffset:Y}),()=>createVNode("div",{class:bem$a(),style:W.value},[q.value?R.default==null?void 0:R.default():null])}}}),SwipeItem=withInstall(_SwipeItem),[name$9,bem$9]=createNamespace("tab"),_Tab=defineComponent({name:name$9,props:extend$2({},routeProps,{dot:Boolean,name:[Number,String],badge:[Number,String],title:String,disabled:Boolean,titleClass:unknownProp,titleStyle:[String,Object]}),setup(B,{slots:R}){var F=ref(!1),{parent:D,index:G}=useParent(TABS_KEY);if(!!D){var U=()=>{var Y;return(Y=B.name)!=null?Y:G.value},W=()=>{F.value=!0,D.props.lazyRender&&nextTick(()=>{D.onRendered(U(),B.title)})},q=computed(()=>{var Y=U()===D.currentName.value;return Y&&!F.value&&W(),Y});return watch(()=>B.title,()=>{D.setLine(),D.scrollIntoView()}),provide(TAB_STATUS_KEY,q),()=>{var{animated:Y,swipeable:K,scrollspy:Z,lazyRender:j}=D.props;if(!(!R.default&&!Y)){var Q=Z||q.value;if(Y||K)return createVNode(SwipeItem,{role:"tabpanel","aria-hidden":!q.value,class:bem$9("pane-wrapper",{inactive:!q.value})},{default:()=>[createVNode("div",{class:bem$9("pane")},[R.default==null?void 0:R.default()])]});var J=F.value||Z||!j,te=J?R.default==null?void 0:R.default():null;return withDirectives(createVNode("div",{role:"tabpanel",class:bem$9("pane")},[te]),[[vShow,Q]])}}}}}),Tab=withInstall(_Tab),Tabs=withInstall(_Tabs),[name$8,bem$8]=createNamespace("cell-group"),_CellGroup=defineComponent({name:name$8,inheritAttrs:!1,props:{title:String,inset:Boolean,border:truthProp},setup(B,{slots:R,attrs:F}){var D=()=>createVNode("div",mergeProps({class:[bem$8({inset:B.inset}),{[BORDER_TOP_BOTTOM]:B.border&&!B.inset}]},F),[R.default==null?void 0:R.default()]),G=()=>createVNode("div",{class:bem$8("title",{inset:B.inset})},[R.title?R.title():B.title]);return()=>B.title||R.title?createVNode(Fragment,null,[G(),D()]):D()}}),CellGroup=withInstall(_CellGroup),[name$7,bem$7]=createNamespace("row"),ROW_KEY=Symbol(name$7),_Row=defineComponent({name:name$7,props:{wrap:truthProp,align:String,justify:String,tag:{type:String,default:"div"},gutter:{type:[Number,String],default:0}},setup(B,{slots:R}){var{children:F,linkChildren:D}=useChildren(ROW_KEY),G=computed(()=>{var W=[[]],q=0;return F.forEach((Y,K)=>{q+=Number(Y.span),q>24?(W.push([K]),q-=24):W[W.length-1].push(K)}),W}),U=computed(()=>{var W=Number(B.gutter),q=[];return W&&G.value.forEach(Y=>{var K=W*(Y.length-1)/Y.length;Y.forEach((Z,j)=>{if(j===0)q.push({right:K});else{var Q=W-q[Z-1].right,J=K-Q;q.push({left:Q,right:J})}})}),q});return D({spaces:U}),()=>{var{tag:W,wrap:q,align:Y,justify:K}=B;return createVNode(W,{class:bem$7({["align-"+Y]:Y,["justify-"+K]:K,nowrap:!q})},{default:()=>[R.default==null?void 0:R.default()]})}}}),[name$6,bem$6]=createNamespace("col"),_Col=defineComponent({name:name$6,props:{offset:[Number,String],tag:{type:String,default:"div"},span:{type:[Number,String],default:0}},setup(B,{slots:R}){var{parent:F,index:D}=useParent(ROW_KEY),G=computed(()=>{if(!!F){var{spaces:U}=F;if(U&&U.value&&U.value[D.value]){var{left:W,right:q}=U.value[D.value];return{paddingLeft:W?W+"px":null,paddingRight:q?q+"px":null}}}});return()=>{var{tag:U,span:W,offset:q}=B;return createVNode(U,{style:G.value,class:bem$6({[W]:W,["offset-"+q]:q})},{default:()=>[R.default==null?void 0:R.default()]})}}}),Col=withInstall(_Col),[name$5,bem$5]=createNamespace("divider"),_Divider=defineComponent({name:name$5,props:{dashed:Boolean,hairline:truthProp,contentPosition:{type:String,default:"center"}},setup(B,{slots:R}){return()=>createVNode("div",{role:"separator",class:bem$5({dashed:B.dashed,hairline:B.hairline,["content-"+B.contentPosition]:!!R.default})},[R.default==null?void 0:R.default()])}}),Divider=withInstall(_Divider),[name$4,bem$4]=createNamespace("grid"),GRID_KEY=Symbol(name$4),props$1={square:Boolean,center:truthProp,border:truthProp,gutter:[Number,String],reverse:Boolean,iconSize:[Number,String],direction:String,clickable:Boolean,columnNum:{type:[Number,String],default:4}},_Grid=defineComponent({name:name$4,props:props$1,setup(B,{slots:R}){var{linkChildren:F}=useChildren(GRID_KEY);return F({props:B}),()=>createVNode("div",{style:{paddingLeft:addUnit(B.gutter)},class:[bem$4(),{[BORDER_TOP]:B.border&&!B.gutter}]},[R.default==null?void 0:R.default()])}}),Grid=withInstall(_Grid),[name$3,bem$3]=createNamespace("grid-item"),_GridItem=defineComponent({name:name$3,props:extend$2({},routeProps,{dot:Boolean,text:String,icon:String,badge:[Number,String],iconPrefix:String,iconColor:String}),setup(B,{slots:R}){var{parent:F,index:D}=useParent(GRID_KEY),G=useRoute();if(!!F){var U=computed(()=>{var{square:Z,gutter:j,columnNum:Q}=F.props,J=100/+Q+"%",te={flexBasis:J};if(Z)te.paddingTop=J;else if(j){var ne=addUnit(j);te.paddingRight=ne,D.value>=Q&&(te.marginTop=ne)}return te}),W=computed(()=>{var{square:Z,gutter:j}=F.props;if(Z&&j){var Q=addUnit(j);return{right:Q,bottom:Q,height:"auto"}}}),q=()=>{if(R.icon)return createVNode(Badge,{dot:B.dot,content:B.badge},{default:()=>[R.icon()]});if(B.icon)return createVNode(Icon,{dot:B.dot,name:B.icon,size:F.props.iconSize,badge:B.badge,class:bem$3("icon"),classPrefix:B.iconPrefix,color:B.iconColor},null)},Y=()=>{if(R.text)return R.text();if(B.text)return createVNode("span",{class:bem$3("text")},[B.text])},K=()=>R.default?R.default():[q(),Y()];return()=>{var{center:Z,border:j,square:Q,gutter:J,reverse:te,direction:ne,clickable:ie}=F.props,re=[bem$3("content",[ne,{center:Z,square:Q,reverse:te,clickable:ie,surround:j&&J}]),{[BORDER]:j}];return createVNode("div",{class:[bem$3({square:Q})],style:U.value},[createVNode("div",{role:ie?"button":void 0,class:re,style:W.value,tabindex:ie?0:void 0,onClick:G},[K()])])}}}}),GridItem=withInstall(_GridItem),[name$2,bem$2]=createNamespace("notice-bar"),_NoticeBar=defineComponent({name:name$2,props:{text:String,mode:String,color:String,leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null},delay:{type:[Number,String],default:1},speed:{type:[Number,String],default:60}},emits:["close","replay"],setup(B,{emit:R,slots:F}){var D=0,G=0,U,W=ref(),q=ref(),Y=reactive({show:!0,offset:0,duration:0}),K=()=>{if(F["left-icon"])return F["left-icon"]();if(B.leftIcon)return createVNode(Icon,{class:bem$2("left-icon"),name:B.leftIcon},null)},Z=()=>{if(B.mode==="closeable")return"cross";if(B.mode==="link")return"arrow"},j=re=>{B.mode==="closeable"&&(Y.show=!1,R("close",re))},Q=()=>{if(F["right-icon"])return F["right-icon"]();var re=Z();if(re)return createVNode(Icon,{name:re,class:bem$2("right-icon"),onClick:j},null)},J=()=>{Y.offset=D,Y.duration=0,raf$2(()=>{doubleRaf(()=>{Y.offset=-G,Y.duration=(G+D)/+B.speed,R("replay")})})},te=()=>{var re=B.scrollable===!1&&!B.wrapable,oe={transform:Y.offset?"translateX("+Y.offset+"px)":"",transitionDuration:Y.duration+"s"};return createVNode("div",{ref:W,role:"marquee",class:bem$2("wrap")},[createVNode("div",{ref:q,style:oe,class:[bem$2("content"),{"van-ellipsis":re}],onTransitionend:J},[F.default?F.default():B.text])])},ne=()=>{D=0,G=0,Y.offset=0,Y.duration=0},ie=()=>{var{delay:re,speed:oe,scrollable:le}=B,fe=isDef$1(re)?+re*1e3:0;ne(),clearTimeout(U),U=setTimeout(()=>{if(!(!W.value||!q.value||le===!1)){var he=useRect(W).width,ge=useRect(q).width;(le||ge>he)&&doubleRaf(()=>{D=he,G=ge,Y.offset=-G,Y.duration=G/+oe})}},fe)};return onPopupReopen(ie),onMountedOrActivated(ie),useEventListener("pageshow",ie),watch(()=>[B.text,B.scrollable],ie),()=>{var{color:re,wrapable:oe,background:le}=B;return withDirectives(createVNode("div",{role:"alert",class:bem$2({wrapable:oe}),style:{color:re,background:le}},[K(),te(),Q()]),[[vShow,Y.show]])}}}),NoticeBar=withInstall(_NoticeBar);function getBoundingClientRect(B){var R=B.getBoundingClientRect();return{width:R.width,height:R.height,top:R.top,right:R.right,bottom:R.bottom,left:R.left,x:R.left,y:R.top}}function getWindow(B){if(B==null)return window;if(B.toString()!=="[object Window]"){var R=B.ownerDocument;return R&&R.defaultView||window}return B}function getWindowScroll(B){var R=getWindow(B),F=R.pageXOffset,D=R.pageYOffset;return{scrollLeft:F,scrollTop:D}}function isElement(B){var R=getWindow(B).Element;return B instanceof R||B instanceof Element}function isHTMLElement(B){var R=getWindow(B).HTMLElement;return B instanceof R||B instanceof HTMLElement}function isShadowRoot(B){if(typeof ShadowRoot=="undefined")return!1;var R=getWindow(B).ShadowRoot;return B instanceof R||B instanceof ShadowRoot}function getHTMLElementScroll(B){return{scrollLeft:B.scrollLeft,scrollTop:B.scrollTop}}function getNodeScroll(B){return B===getWindow(B)||!isHTMLElement(B)?getWindowScroll(B):getHTMLElementScroll(B)}function getNodeName(B){return B?(B.nodeName||"").toLowerCase():null}function getDocumentElement(B){return((isElement(B)?B.ownerDocument:B.document)||window.document).documentElement}function getWindowScrollBarX(B){return getBoundingClientRect(getDocumentElement(B)).left+getWindowScroll(B).scrollLeft}function getComputedStyle(B){return getWindow(B).getComputedStyle(B)}function isScrollParent(B){var R=getComputedStyle(B),F=R.overflow,D=R.overflowX,G=R.overflowY;return/auto|scroll|overlay|hidden/.test(F+G+D)}function getCompositeRect(B,R,F){F===void 0&&(F=!1);var D=getDocumentElement(R),G=getBoundingClientRect(B),U=isHTMLElement(R),W={scrollLeft:0,scrollTop:0},q={x:0,y:0};return(U||!U&&!F)&&((getNodeName(R)!=="body"||isScrollParent(D))&&(W=getNodeScroll(R)),isHTMLElement(R)?(q=getBoundingClientRect(R),q.x+=R.clientLeft,q.y+=R.clientTop):D&&(q.x=getWindowScrollBarX(D))),{x:G.left+W.scrollLeft-q.x,y:G.top+W.scrollTop-q.y,width:G.width,height:G.height}}function getLayoutRect(B){var R=getBoundingClientRect(B),F=B.offsetWidth,D=B.offsetHeight;return Math.abs(R.width-F)<=1&&(F=R.width),Math.abs(R.height-D)<=1&&(D=R.height),{x:B.offsetLeft,y:B.offsetTop,width:F,height:D}}function getParentNode(B){return getNodeName(B)==="html"?B:B.assignedSlot||B.parentNode||(isShadowRoot(B)?B.host:null)||getDocumentElement(B)}function getScrollParent(B){return["html","body","#document"].indexOf(getNodeName(B))>=0?B.ownerDocument.body:isHTMLElement(B)&&isScrollParent(B)?B:getScrollParent(getParentNode(B))}function listScrollParents(B,R){var F;R===void 0&&(R=[]);var D=getScrollParent(B),G=D===((F=B.ownerDocument)==null?void 0:F.body),U=getWindow(D),W=G?[U].concat(U.visualViewport||[],isScrollParent(D)?D:[]):D,q=R.concat(W);return G?q:q.concat(listScrollParents(getParentNode(W)))}function isTableElement(B){return["table","td","th"].indexOf(getNodeName(B))>=0}function getTrueOffsetParent(B){return!isHTMLElement(B)||getComputedStyle(B).position==="fixed"?null:B.offsetParent}function getContainingBlock(B){var R=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,F=navigator.userAgent.indexOf("Trident")!==-1;if(F&&isHTMLElement(B)){var D=getComputedStyle(B);if(D.position==="fixed")return null}for(var G=getParentNode(B);isHTMLElement(G)&&["html","body"].indexOf(getNodeName(G))<0;){var U=getComputedStyle(G);if(U.transform!=="none"||U.perspective!=="none"||U.contain==="paint"||["transform","perspective"].indexOf(U.willChange)!==-1||R&&U.willChange==="filter"||R&&U.filter&&U.filter!=="none")return G;G=G.parentNode}return null}function getOffsetParent(B){for(var R=getWindow(B),F=getTrueOffsetParent(B);F&&isTableElement(F)&&getComputedStyle(F).position==="static";)F=getTrueOffsetParent(F);return F&&(getNodeName(F)==="html"||getNodeName(F)==="body"&&getComputedStyle(F).position==="static")?R:F||getContainingBlock(B)||R}var top$1="top",bottom$1="bottom",right="right",left$1="left",auto="auto",basePlacements=[top$1,bottom$1,right,left$1],start$4="start",end="end",placements=[].concat(basePlacements,[auto]).reduce(function(B,R){return B.concat([R,R+"-"+start$4,R+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main,afterMain,beforeWrite,write,afterWrite];function order(B){var R=new Map,F=new Set,D=[];B.forEach(function(U){R.set(U.name,U)});function G(U){F.add(U.name);var W=[].concat(U.requires||[],U.requiresIfExists||[]);W.forEach(function(q){if(!F.has(q)){var Y=R.get(q);Y&&G(Y)}}),D.push(U)}return B.forEach(function(U){F.has(U.name)||G(U)}),D}function orderModifiers(B){var R=order(B);return modifierPhases.reduce(function(F,D){return F.concat(R.filter(function(G){return G.phase===D}))},[])}function debounce(B){var R;return function(){return R||(R=new Promise(function(F){Promise.resolve().then(function(){R=void 0,F(B())})})),R}}function getBasePlacement(B){return B.split("-")[0]}function mergeByName(B){var R=B.reduce(function(F,D){var G=F[D.name];return F[D.name]=G?Object.assign({},G,D,{options:Object.assign({},G.options,D.options),data:Object.assign({},G.data,D.data)}):D,F},{});return Object.keys(R).map(function(F){return R[F]})}var round=Math.round;function getVariation(B){return B.split("-")[1]}function getMainAxisFromPlacement(B){return["top","bottom"].indexOf(B)>=0?"x":"y"}function computeOffsets(B){var R=B.reference,F=B.element,D=B.placement,G=D?getBasePlacement(D):null,U=D?getVariation(D):null,W=R.x+R.width/2-F.width/2,q=R.y+R.height/2-F.height/2,Y;switch(G){case top$1:Y={x:W,y:R.y-F.height};break;case bottom$1:Y={x:W,y:R.y+R.height};break;case right:Y={x:R.x+R.width,y:q};break;case left$1:Y={x:R.x-F.width,y:q};break;default:Y={x:R.x,y:R.y}}var K=G?getMainAxisFromPlacement(G):null;if(K!=null){var Z=K==="y"?"height":"width";switch(U){case start$4:Y[K]=Y[K]-(R[Z]/2-F[Z]/2);break;case end:Y[K]=Y[K]+(R[Z]/2-F[Z]/2);break}}return Y}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var B=arguments.length,R=new Array(B),F=0;F=0?-1:1,U=typeof F=="function"?F(Object.assign({},R,{placement:B})):F,W=U[0],q=U[1];return W=W||0,q=(q||0)*G,[left$1,right].indexOf(D)>=0?{x:q,y:W}:{x:W,y:q}}function offset(B){var R=B.state,F=B.options,D=B.name,G=F.offset,U=G===void 0?[0,0]:G,W=placements.reduce(function(Z,j){return Z[j]=distanceAndSkiddingToXY(j,R.rects,U),Z},{}),q=W[R.placement],Y=q.x,K=q.y;R.modifiersData.popperOffsets!=null&&(R.modifiersData.popperOffsets.x+=Y,R.modifiersData.popperOffsets.y+=K),R.modifiersData[D]=W}var offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset},[name$1,bem$1]=createNamespace("popover"),popupProps=["show","overlay","duration","teleport","overlayStyle","overlayClass","closeOnClickOverlay"],_Popover=defineComponent({name:name$1,props:{show:Boolean,overlay:Boolean,duration:[Number,String],iconPrefix:String,overlayClass:unknownProp,overlayStyle:Object,closeOnClickAction:truthProp,closeOnClickOverlay:truthProp,closeOnClickOutside:truthProp,offset:{type:Array,default:()=>[0,8]},theme:{type:String,default:"light"},trigger:{type:String,default:"click"},actions:{type:Array,default:()=>[]},placement:{type:String,default:"bottom"},teleport:{type:[String,Object],default:"body"}},emits:["select","touchstart","update:show"],setup(B,{emit:R,slots:F,attrs:D}){var G,U=ref(),W=ref(),q=()=>createPopper(U.value,W.value.popupRef.value,{placement:B.placement,modifiers:[{name:"computeStyles",options:{adaptive:!1,gpuAcceleration:!1}},extend$2({},offset$1,{options:{offset:B.offset}})]}),Y=()=>{nextTick(()=>{!B.show||(G?G.setOptions({placement:B.placement}):G=q())})},K=ne=>R("update:show",ne),Z=()=>{B.trigger==="click"&&K(!B.show)},j=ne=>{ne.stopPropagation(),R("touchstart",ne)},Q=(ne,ie)=>{ne.disabled||(R("select",ne,ie),B.closeOnClickAction&&K(!1))},J=()=>{B.closeOnClickOutside&&(!B.overlay||B.closeOnClickOverlay)&&K(!1)},te=(ne,ie)=>{var{icon:re,text:oe,color:le,disabled:fe,className:he}=ne;return createVNode("div",{role:"menuitem",class:[bem$1("action",{disabled:fe,"with-icon":re}),he],style:{color:le},onClick:()=>Q(ne,ie)},[re&&createVNode(Icon,{name:re,classPrefix:B.iconPrefix,class:bem$1("action-icon")},null),createVNode("div",{class:[bem$1("action-text"),BORDER_BOTTOM]},[oe])])};return onMounted(Y),onBeforeUnmount(()=>{G&&(G.destroy(),G=null)}),watch(()=>[B.show,B.placement],Y),useClickAway(U,J,{eventName:"touchstart"}),()=>createVNode(Fragment,null,[createVNode("span",{ref:U,class:bem$1("wrapper"),onClick:Z},[F.reference==null?void 0:F.reference()]),createVNode(Popup,mergeProps({ref:W,class:bem$1([B.theme]),position:"",transition:"van-popover-zoom",lockScroll:!1,onTouchstart:j},D,pick(B,popupProps),{"onUpdate:show":K}),{default:()=>[createVNode("div",{class:bem$1("arrow")},null),createVNode("div",{role:"menu",class:bem$1("content")},[F.default?F.default():B.actions.map(te)])]})])}}),Popover=withInstall(_Popover),Row=withInstall(_Row),[name,bem]=createNamespace("slider"),_Slider=defineComponent({name,props:{range:Boolean,disabled:Boolean,readonly:Boolean,vertical:Boolean,barHeight:[Number,String],buttonSize:[Number,String],activeColor:String,inactiveColor:String,min:{type:[Number,String],default:0},max:{type:[Number,String],default:100},step:{type:[Number,String],default:1},modelValue:{type:[Number,Array],default:0}},emits:["change","drag-end","drag-start","update:modelValue"],setup(B,{emit:R,slots:F}){var D,G,U,W=ref(),q=ref(),Y=useTouch(),K=computed(()=>Number(B.max)-Number(B.min)),Z=computed(()=>{var me=B.vertical?"width":"height";return{background:B.inactiveColor,[me]:addUnit(B.barHeight)}}),j=me=>!!B.range&&Array.isArray(me),Q=()=>{var{modelValue:me,min:ye}=B;return j(me)?(me[1]-me[0])*100/K.value+"%":(me-Number(ye))*100/K.value+"%"},J=()=>{var{modelValue:me,min:ye}=B;return j(me)?(me[0]-Number(ye))*100/K.value+"%":"0%"},te=computed(()=>{var me=B.vertical?"height":"width";return{[me]:Q(),left:B.vertical?void 0:J(),top:B.vertical?J():void 0,background:B.activeColor,transition:q.value?"none":void 0}}),ne=me=>{var ye=+B.min,ve=+B.max,pe=+B.step;me=clamp(me,ye,ve);var be=Math.round((me-ye)/pe)*pe;return addNumber(ye,be)},ie=(me,ye)=>JSON.stringify(me)===JSON.stringify(ye),re=me=>me[0]>me[1]?me.slice(0).reverse():me,oe=(me,ye)=>{j(me)?me=re(me).map(ne):me=ne(me),ie(me,B.modelValue)||R("update:modelValue",me),ye&&!ie(me,G)&&R("change",me)},le=me=>{if(me.stopPropagation(),!(B.disabled||B.readonly)){var{min:ye,vertical:ve,modelValue:pe}=B,be=useRect(W),xe=ve?me.clientY-be.top:me.clientX-be.left,ue=ve?be.height:be.width,_e=Number(ye)+xe/ue*K.value;if(j(pe)){var[Be,Ae]=pe,Pe=(Be+Ae)/2;_e<=Pe?oe([_e,Ae],!0):oe([Be,_e],!0)}else oe(_e,!0)}},fe=me=>{B.disabled||B.readonly||(Y.start(me),U=B.modelValue,j(U)?G=U.map(ne):G=ne(U),q.value="start")},he=me=>{if(!(B.disabled||B.readonly)){q.value==="start"&&R("drag-start"),preventDefault(me,!0),Y.move(me),q.value="draging";var ye=useRect(W),ve=B.vertical?Y.deltaY.value:Y.deltaX.value,pe=B.vertical?ye.height:ye.width,be=ve/pe*K.value;j(G)?U[D]=G[D]+be:U=G+be,oe(U)}},ge=()=>{B.disabled||B.readonly||(q.value==="draging"&&(oe(U,!0),R("drag-end")),q.value="")},ce=me=>{var ye=()=>{if(typeof me=="number"){var pe=["left","right"];return"button-wrapper-"+pe[me]}return"button-wrapper"},ve=typeof me=="number"?B.modelValue[me]:B.modelValue;return createVNode("div",{role:"slider",class:bem(ye()),tabindex:B.disabled||B.readonly?-1:0,"aria-valuemin":+B.min,"aria-valuenow":ve,"aria-valuemax":+B.max,"aria-orientation":B.vertical?"vertical":"horizontal",onTouchstart:pe=>{typeof me=="number"&&(D=me),fe(pe)},onTouchmove:he,onTouchend:ge,onTouchcancel:ge,onClick:stopPropagation},[F.button?F.button():createVNode("div",{class:bem("button"),style:getSizeStyle(B.buttonSize)},null)])};return oe(B.modelValue),useLinkField(()=>B.modelValue),()=>createVNode("div",{ref:W,style:Z.value,class:bem({vertical:B.vertical,disabled:B.disabled}),onClick:le},[createVNode("div",{class:bem("bar"),style:te.value},[B.range?[ce(0),ce(1)]:ce()])])}}),Slider=withInstall(_Slider),lodash_isempty={exports:{}};(function(B,R){var F=9007199254740991,D="[object Arguments]",G="[object Function]",U="[object GeneratorFunction]",W="[object Map]",q="[object Object]",Y="[object Promise]",K="[object Set]",Z="[object WeakMap]",j="[object DataView]",Q=/[\\^$.*+?()[\]{}|]/g,J=/^\[object .+?Constructor\]$/,te=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,ne=typeof self=="object"&&self&&self.Object===Object&&self,ie=te||ne||Function("return this")(),re=R&&!R.nodeType&&R,oe=re&&!0&&B&&!B.nodeType&&B,le=oe&&oe.exports===re;function fe(st,xt){return st==null?void 0:st[xt]}function he(st){var xt=!1;if(st!=null&&typeof st.toString!="function")try{xt=!!(st+"")}catch{}return xt}function ge(st,xt){return function(Nt){return st(xt(Nt))}}var ce=Function.prototype,me=Object.prototype,ye=ie["__core-js_shared__"],ve=function(){var st=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return st?"Symbol(src)_1."+st:""}(),pe=ce.toString,be=me.hasOwnProperty,xe=me.toString,ue=RegExp("^"+pe.call(be).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_e=le?ie.Buffer:void 0,Be=me.propertyIsEnumerable,Ae=_e?_e.isBuffer:void 0,Pe=ge(Object.keys,Object),Ie=ft(ie,"DataView"),Ce=ft(ie,"Map"),Te=ft(ie,"Promise"),Se=ft(ie,"Set"),Ne=ft(ie,"WeakMap"),Ge=!Be.call({valueOf:1},"valueOf"),ke=Ke(Ie),$e=Ke(Ce),We=Ke(Te),Ve=Ke(Se),qe=Ke(Ne);function et(st){return xe.call(st)}function ot(st){if(!ct(st)||Ee(st))return!1;var xt=rt(st)||he(st)?ue:J;return xt.test(Ke(st))}function ft(st,xt){var Nt=fe(st,xt);return ot(Nt)?Nt:void 0}var lt=et;(Ie&<(new Ie(new ArrayBuffer(1)))!=j||Ce&<(new Ce)!=W||Te&<(Te.resolve())!=Y||Se&<(new Se)!=K||Ne&<(new Ne)!=Z)&&(lt=function(st){var xt=xe.call(st),Nt=xt==q?st.constructor:void 0,$t=Nt?Ke(Nt):void 0;if($t)switch($t){case ke:return j;case $e:return W;case We:return Y;case Ve:return K;case qe:return Z}return xt});function Ee(st){return!!ve&&ve in st}function je(st){var xt=st&&st.constructor,Nt=typeof xt=="function"&&xt.prototype||me;return st===Nt}function Ke(st){if(st!=null){try{return pe.call(st)}catch{}try{return st+""}catch{}}return""}function Oe(st){return Qe(st)&&be.call(st,"callee")&&(!Be.call(st,"callee")||xe.call(st)==D)}var Fe=Array.isArray;function He(st){return st!=null&&dt(st.length)&&!rt(st)}function Qe(st){return bt(st)&&He(st)}var tt=Ae||wt;function Xe(st){if(He(st)&&(Fe(st)||typeof st=="string"||typeof st.splice=="function"||tt(st)||Oe(st)))return!st.length;var xt=lt(st);if(xt==W||xt==K)return!st.size;if(Ge||je(st))return!Pe(st).length;for(var Nt in st)if(be.call(st,Nt))return!1;return!0}function rt(st){var xt=ct(st)?xe.call(st):"";return xt==G||xt==U}function dt(st){return typeof st=="number"&&st>-1&&st%1==0&&st<=F}function ct(st){var xt=typeof st;return!!st&&(xt=="object"||xt=="function")}function bt(st){return!!st&&typeof st=="object"}function wt(){return!1}B.exports=Xe})(lodash_isempty,lodash_isempty.exports);var objectTag="[object Object]";function isHostObject(B){var R=!1;if(B!=null&&typeof B.toString!="function")try{R=!!(B+"")}catch{}return R}function overArg(B,R){return function(F){return B(R(F))}}var funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object),objectToString=objectProto.toString,getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(B){return!!B&&typeof B=="object"}function isPlainObject$1(B){if(!isObjectLike(B)||objectToString.call(B)!=objectTag||isHostObject(B))return!1;var R=getPrototype(B);if(R===null)return!0;var F=hasOwnProperty.call(R,"constructor")&&R.constructor;return typeof F=="function"&&F instanceof F&&funcToString.call(F)==objectCtorString}var lodash_isplainobject=isPlainObject$1,lodash_transform={exports:{}};(function(B,R){var F=200,D="Expected a function",G="__lodash_hash_undefined__",U=1,W=2,q=1/0,Y=9007199254740991,K="[object Arguments]",Z="[object Array]",j="[object Boolean]",Q="[object Date]",J="[object Error]",te="[object Function]",ne="[object GeneratorFunction]",ie="[object Map]",re="[object Number]",oe="[object Object]",le="[object Promise]",fe="[object RegExp]",he="[object Set]",ge="[object String]",ce="[object Symbol]",me="[object WeakMap]",ye="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",be="[object Float64Array]",xe="[object Int8Array]",ue="[object Int16Array]",_e="[object Int32Array]",Be="[object Uint8Array]",Ae="[object Uint8ClampedArray]",Pe="[object Uint16Array]",Ie="[object Uint32Array]",Ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Te=/^\w*$/,Se=/^\./,Ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ge=/[\\^$.*+?()[\]{}|]/g,ke=/\\(\\)?/g,$e=/^\[object .+?Constructor\]$/,We=/^(?:0|[1-9]\d*)$/,Ve={};Ve[pe]=Ve[be]=Ve[xe]=Ve[ue]=Ve[_e]=Ve[Be]=Ve[Ae]=Ve[Pe]=Ve[Ie]=!0,Ve[K]=Ve[Z]=Ve[ye]=Ve[j]=Ve[ve]=Ve[Q]=Ve[J]=Ve[te]=Ve[ie]=Ve[re]=Ve[oe]=Ve[fe]=Ve[he]=Ve[ge]=Ve[me]=!1;var qe=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,et=typeof self=="object"&&self&&self.Object===Object&&self,ot=qe||et||Function("return this")(),ft=R&&!R.nodeType&&R,lt=ft&&!0&&B&&!B.nodeType&&B,Ee=lt&<.exports===ft,je=Ee&&qe.process,Ke=function(){try{return je&&je.binding("util")}catch{}}(),Oe=Ke&&Ke.isTypedArray;function Fe(Le,ze){for(var nt=-1,gt=Le?Le.length:0;++nt-1}function ss(Le,ze){var nt=this.__data__,gt=os(nt,Le);return gt<0?nt.push([Le,ze]):nt[gt][1]=ze,this}Fi.prototype.clear=Ts,Fi.prototype.delete=io,Fi.prototype.get=no,Fi.prototype.has=so,Fi.prototype.set=ss;function Ji(Le){var ze=-1,nt=Le?Le.length:0;for(this.clear();++zeTt))return!1;var ei=St.get(Le);if(ei&&St.get(ze))return ei==ze;var di=-1,hi=!0,oi=Et&U?new Bn:void 0;for(St.set(Le,ze),St.set(ze,Le);++di-1&&Le%1==0&&Le-1&&Le%1==0&&Le<=Y}function Pi(Le){var ze=typeof Le;return!!Le&&(ze=="object"||ze=="function")}function Gn(Le){return!!Le&&typeof Le=="object"}function $n(Le){return typeof Le=="symbol"||Gn(Le)&&Qt.call(Le)==ce}var Si=Oe?Xe(Oe):Ms;function dr(Le){return Le==null?"":ar(Le)}function pr(Le,ze,nt){var gt=Le==null?void 0:er(Le,ze);return gt===void 0?nt:gt}function mr(Le,ze){return Le!=null&&bo(Le,ze,ir)}function zn(Le){return Ls(Le)?Ps(Le):sr(Le)}function gr(Le,ze,nt){var gt=en(Le)||Si(Le);if(ze=Pn(ze),nt==null)if(gt||Pi(Le)){var Et=Le.constructor;gt?nt=en(Le)?new Et:[]:nt=ii(Et)?Js(Zt(Le)):{}}else nt={};return(gt?Fe:Qs)(Le,function(St,Bt,Tt){return ze(nt,St,Bt,Tt)}),nt}function br(Le){return Le}function xi(Le){return cs(Le)?Qe(us(Le)):or(Le)}B.exports=gr})(lodash_transform,lodash_transform.exports);const isEmpty$1=lodash_isempty.exports,isPlainObject=lodash_isplainobject,transform=lodash_transform.exports;var src=function B(R,{cleanKeys:F=[],cleanValues:D=[],emptyArrays:G=!0,emptyObjects:U=!0,emptyStrings:W=!0,NaNValues:q=!1,nullValues:Y=!0,undefinedValues:K=!0}={}){return transform(R,(Z,j,Q)=>{if(!F.includes(Q)&&((Array.isArray(j)||isPlainObject(j))&&(j=B(j,{NaNValues:q,cleanKeys:F,cleanValues:D,emptyArrays:G,emptyObjects:U,emptyStrings:W,nullValues:Y,undefinedValues:K})),!D.includes(j)&&!(U&&isPlainObject(j)&&isEmpty$1(j))&&!(G&&Array.isArray(j)&&!j.length)&&!(W&&j==="")&&!(q&&Number.isNaN(j))&&!(Y&&j===null)&&!(K&&j===void 0))){if(Array.isArray(Z))return Z.push(j);Z[Q]=j}})};let isOpenLogin=!1;const request=extend$1({requestType:"json",timeout:1e4,prefix:getRequestHostname()});request.use(async(B,R)=>{B.req,await R()});request.interceptors.request.use((B,R)=>{const F=sessionStorage.getItem("Authorization")||"",D={};return F&&!["/api-auth/usernameLogin","/api-auth/smsLogin","/api-auth/code/sendSms"].includes(B)&&(D.Authorization=F),{url:B,options:{...R,params:src(R.params),headers:{...R.headers,...D}}}},{global:!1});request.interceptors.response.use(async(B,R)=>{if(new URL(B.url),B.status>299||B.status<200){const D="\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u72B6\u6001\u7801"+B.status;throw Toast(D),new Error(D)}const F=await B.clone().json();if(F.code!==200&&F.errCode!==0){const D=F.msg||"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";F.code===403||F.code===401||Toast(D);const G=browser();throw F.code===403&&G.isApp&&!isOpenLogin&&(G.android?(postMessage({api:"login"}),window.DAYA.postMessage(JSON.stringify({api:"login"}))):G.iPhone&&window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({api:"login"}))),new Error(D)}return B},{global:!1});class AJAX{static ajax(R,F=9e3){let D;const G=R.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)D=new XMLHttpRequest;else if(ActiveXObject)D=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return D.timeout=F,new Promise((U,W)=>{D.onreadystatechange=()=>{D.readyState===XMLHttpRequest.DONE&&(D.status===200||D.status===0&&D.responseText?U(D.responseText):W(new Error("Could not retrieve requested URL "+D.status)))},D.ontimeout=q=>{W(new Error("Server request Timeout"))},D.overrideMimeType(G),D.open("GET",R,!0),D.send()})}}const _Fraction=class{constructor(B=0,R=1,F=0,D=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=B,this.denominator=R,this.wholeValue=F,D&&this.simplify(),this.setRealValue()}static max(B,R){return B.RealValue>R.RealValue?B:R}static Equal(B,R){return B.wholeValue===R.wholeValue&&B.Denominator===R.Denominator&&B.Numerator===R.Numerator}static createFromFraction(B){return new _Fraction(B.numerator,B.denominator,B.wholeValue,!1)}static plus(B,R){const F=B.clone();return F.Add(R),F}static minus(B,R){const F=B.clone();return F.Sub(R),F}static multiply(B,R){return new _Fraction((B.wholeValue*B.denominator+B.numerator)*(R.wholeValue*R.denominator+R.numerator),B.denominator*R.denominator)}static greatestCommonDenominator(B,R){if(B===0)return R;if(R===1)return 1;for(;Math.abs(R)>1e-8;)B>R?B-=R:R-=B;return Math.round(B)}toString(){let B=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(B=this.wholeValue+" "+B),B}clone(){return new _Fraction(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(B){this.numerator!==B&&(this.numerator=B,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(B){this.denominator!==B&&(this.denominator=B,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(B){this.wholeValue!==B&&(this.wholeValue=B,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let B=1,R=2;const F=this.GetExpandedNumerator();for(;RB;)R.Numerator++;if(this.numerator>this.denominator){const F=new _Fraction(this.numerator-1,this.denominator,this.wholeValue);for(;F.Denominator>B;)F.Numerator--;if(F.Denominator_Fraction.maximumAllowedNumber){const F=this.denominator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/F),this.denominator=Math.round(this.denominator/F)}if(this.numerator>_Fraction.maximumAllowedNumber){const F=this.numerator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/F),this.denominator=Math.round(this.denominator/F)}}isOnBeat(B){const R=this.distanceFromBeat(B);return Math.abs(R)<_Fraction.FloatInaccuracyTolerance}distanceFromBeat(B){const R=new _Fraction(1,B.Denominator);return this.RealValue%R.RealValue}};let Fraction$1=_Fraction;Fraction$1.maximumAllowedNumber=46340;Fraction$1.FloatInaccuracyTolerance=1e-4;class AbstractExpression{constructor(R){this.placement=R}static isStringInStringList(R,F){for(let D=0,G=R.length;D(B[B.Above=0]="Above",B[B.Below=1]="Below",B[B.Left=2]="Left",B[B.Right=3]="Right",B[B.NotYetDefined=4]="NotYetDefined",B[B.AboveOrBelow=5]="AboveOrBelow",B))(PlacementEnum||{});const _ContinuousDynamicExpression=class extends AbstractExpression{constructor(B,R,F,D,G,U,W=""){super(R),super.parentMeasure=D,this.NumberXml=U,this.dynamicType=B,this.label=W,this.staffNumber=F,this.activeInstantaneousDynamic=G,this.startVolume=1,this.endVolume=1,this.setStartAndEndVolume(),W!==""&&this.setType()}setStartAndEndVolume(){this.activeInstantaneousDynamic&&(this.dynamicType===ContDynamicEnum.crescendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*1.2),this.dynamicType===ContDynamicEnum.diminuendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*.8))}get DynamicType(){return this.dynamicType}set DynamicType(B){this.dynamicType=B}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(B){this.startMultiExpression=B}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(B){this.endMultiExpression=B}get Placement(){return this.placement}set Placement(B){this.placement=B}get StartVolume(){return this.startVolume}set StartVolume(B){this.startVolume=B}get EndVolume(){return this.endVolume}set EndVolume(B){this.endVolume=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Label(){return this.label}set Label(B){this.label=B,this.setType()}static isInputStringContinuousDynamic(B){return B?_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,B)||_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,B):!1}getInterpolatedDynamic(B){const R=this.StartMultiExpression.AbsoluteTimestamp;let F;if(this.EndMultiExpression?F=this.EndMultiExpression.AbsoluteTimestamp:F=Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),B.lt(R))return-1;if(F.lt(B))return-2;const D=Fraction$1.minus(B,R).RealValue/Fraction$1.minus(F,R).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*D))}isWedge(){return!this.label}setType(){_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,this.label)?this.dynamicType=ContDynamicEnum.crescendo:_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=ContDynamicEnum.diminuendo)}};let ContinuousDynamicExpression=_ContinuousDynamicExpression;ContinuousDynamicExpression.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."];ContinuousDynamicExpression.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];var ContDynamicEnum=(B=>(B[B.crescendo=0]="crescendo",B[B.diminuendo=1]="diminuendo",B))(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=(B=>(B[B.p=0]="p",B[B.f=1]="f",B[B.s=2]="s",B[B.z=3]="z",B[B.m=4]="m",B[B.r=5]="r",B))(DynamicExpressionSymbolEnum||{});class MusicSheetReadingException{constructor(R,F){this.message=R,F&&(this.message+=" "+F.toString())}}class ArgumentOutOfRangeException{constructor(R){this.message=R}}class InvalidEnumArgumentException{constructor(R){this.message=R}}var loglevel={exports:{}};(function(B){(function(R,F){B.exports?B.exports=F():R.log=F()})(commonjsGlobal$1,function(){var R=function(){},F="undefined",D=typeof window!==F&&typeof window.navigator!==F&&/Trident\/|MSIE /.test(window.navigator.userAgent),G=["trace","debug","info","warn","error"];function U(ne,ie){var re=ne[ie];if(typeof re.bind=="function")return re.bind(ne);try{return Function.prototype.bind.call(re,ne)}catch{return function(){return Function.prototype.apply.apply(re,[ne,arguments])}}}function W(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function q(ne){return ne==="debug"&&(ne="log"),typeof console===F?!1:ne==="trace"&&D?W:console[ne]!==void 0?U(console,ne):console.log!==void 0?U(console,"log"):R}function Y(ne,ie){for(var re=0;re=0&&ye<=oe.levels.SILENT){if(le=ye,ve!==!1&&he(ye),Y.call(oe,ye,ne),typeof console===F&&ye=0;U--)if(D(B[U],R))return U;return-1}arrays$4.lastIndexOf=lastIndexOf;function contains(B,R,F){return indexOf$1(B,R,F)>=0}arrays$4.contains=contains;function remove(B,R,F){var D=indexOf$1(B,R,F);return D<0?!1:(B.splice(D,1),!0)}arrays$4.remove=remove;function frequency(B,R,F){for(var D=F||util$9.defaultEquals,G=B.length,U=0,W=0;W=B.length||F<0||F>=B.length)return!1;var D=B[R];return B[R]=B[F],B[F]=D,!0}arrays$4.swap=swap;function toString$1(B){return"["+B.toString()+"]"}arrays$4.toString=toString$1;function forEach(B,R){for(var F=0,D=B;FR.size())return!1;var F=!0;return this.forEach(function(D){return R.contains(D)?!0:(F=!1,!1)}),F},B.prototype.remove=function(R){return this.contains(R)?(this.dictionary.remove(R),!0):!1},B.prototype.forEach=function(R){this.dictionary.forEach(function(F,D){return R(D)})},B.prototype.toArray=function(){return this.dictionary.values()},B.prototype.isEmpty=function(){return this.dictionary.isEmpty()},B.prototype.size=function(){return this.dictionary.size()},B.prototype.clear=function(){this.dictionary.clear()},B.prototype.toString=function(){return arrays$3.toString(this.toArray())},B}();_Set.default=Set$1;Object.defineProperty(Bag$1,"__esModule",{value:!0});var util$6=util$a,Dictionary_1$4=Dictionary$2,Set_1$1=_Set,Bag=function(){function B(R){this.toStrF=R||util$6.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return B.prototype.add=function(R,F){if(F===void 0&&(F=1),util$6.isUndefined(R)||F<=0)return!1;if(this.contains(R))this.dictionary.getValue(R).copies+=F;else{var D={value:R,copies:F};this.dictionary.setValue(R,D)}return this.nElements+=F,!0},B.prototype.count=function(R){return this.contains(R)?this.dictionary.getValue(R).copies:0},B.prototype.contains=function(R){return this.dictionary.containsKey(R)},B.prototype.remove=function(R,F){if(F===void 0&&(F=1),util$6.isUndefined(R)||F<=0)return!1;if(this.contains(R)){var D=this.dictionary.getValue(R);return F>D.copies?this.nElements-=D.copies:this.nElements-=F,D.copies-=F,D.copies<=0&&this.dictionary.remove(R),!0}else return!1},B.prototype.toArray=function(){for(var R=[],F=this.dictionary.values(),D=0,G=F;Dthis.nElements||util$5.isUndefined(R))return!1;var D=this.createNode(R);if(this.nElements===0||this.lastNode===null)this.firstNode=D,this.lastNode=D;else if(F===this.nElements)this.lastNode.next=D,this.lastNode=D;else if(F===0)D.next=this.firstNode,this.firstNode=D;else{var G=this.nodeAtIndex(F-1);if(G===null)return!1;D.next=G.next,G.next=D}return this.nElements++,!0},B.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},B.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},B.prototype.elementAtIndex=function(R){var F=this.nodeAtIndex(R);if(F!==null)return F.element},B.prototype.indexOf=function(R,F){var D=F||util$5.defaultEquals;if(util$5.isUndefined(R))return-1;for(var G=this.firstNode,U=0;G!==null;){if(D(G.element,R))return U;U++,G=G.next}return-1},B.prototype.contains=function(R,F){return this.indexOf(R,F)>=0},B.prototype.remove=function(R,F){var D=F||util$5.defaultEquals;if(this.nElements<1||util$5.isUndefined(R))return!1;for(var G=null,U=this.firstNode;U!==null;){if(D(U.element,R))return G===null?(this.firstNode=U.next,U===this.lastNode&&(this.lastNode=null)):U===this.lastNode?(this.lastNode=G,G.next=U.next,U.next=null):(G.next=U.next,U.next=null),this.nElements--,!0;G=U,U=U.next}return!1},B.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},B.prototype.equals=function(R,F){var D=F||util$5.defaultEquals;return!(R instanceof B)||this.size()!==R.size()?!1:this.equalsAux(this.firstNode,R.firstNode,D)},B.prototype.equalsAux=function(R,F,D){for(;R!==null&&F!==null;){if(!D(R.element,F.element))return!1;R=R.next,F=F.next}return!0},B.prototype.removeElementAtIndex=function(R){if(!(R<0||R>=this.nElements||this.firstNode===null||this.lastNode===null)){var F;if(this.nElements===1)F=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var D=this.nodeAtIndex(R-1);D===null?(F=this.firstNode.element,this.firstNode=this.firstNode.next):D.next===this.lastNode&&(F=this.lastNode.element,this.lastNode=D),D!==null&&D.next!==null&&(F=D.next.element,D.next=D.next.next)}return this.nElements--,F}},B.prototype.forEach=function(R){for(var F=this.firstNode;F!==null&&R(F.element)!==!1;)F=F.next},B.prototype.reverse=function(){for(var R=null,F=this.firstNode,D=null;F!==null;)D=F.next,F.next=R,R=F,F=D;D=this.firstNode,this.firstNode=this.lastNode,this.lastNode=D},B.prototype.toArray=function(){for(var R=[],F=this.firstNode;F!==null;)R.push(F.element),F=F.next;return R},B.prototype.size=function(){return this.nElements},B.prototype.isEmpty=function(){return this.nElements<=0},B.prototype.toString=function(){return arrays$2.toString(this.toArray())},B.prototype.nodeAtIndex=function(R){if(R<0||R>=this.nElements)return null;if(R===this.nElements-1)return this.lastNode;for(var F=this.firstNode,D=0;D0&&(R=R.rightCh);return R},B.prototype.transplant=function(R,F){R.parent===null?this.root=F:R===R.parent.leftCh?R.parent.leftCh=F:R.parent.rightCh=F,F!==null&&(F.parent=R.parent)},B.prototype.removeNode=function(R){if(R.leftCh===null)this.transplant(R,R.rightCh);else if(R.rightCh===null)this.transplant(R,R.leftCh);else{var F=this.minimumAux(R.rightCh);F.parent!==R&&(this.transplant(F,F.rightCh),F.rightCh=R.rightCh,F.rightCh.parent=F),this.transplant(R,F),F.leftCh=R.leftCh,F.leftCh.parent=F}},B.prototype.inorderTraversalAux=function(R,F,D){R===null||D.stop||(this.inorderTraversalAux(R.leftCh,F,D),!D.stop&&(D.stop=F(R.element)===!1,!D.stop&&this.inorderTraversalAux(R.rightCh,F,D)))},B.prototype.levelTraversalAux=function(R,F){var D=new Queue_1$1.default;for(R!==null&&D.enqueue(R),R=D.dequeue()||null;R!=null;){if(F(R.element)===!1)return;R.leftCh!==null&&D.enqueue(R.leftCh),R.rightCh!==null&&D.enqueue(R.rightCh),R=D.dequeue()||null}},B.prototype.preorderTraversalAux=function(R,F,D){R===null||D.stop||(D.stop=F(R.element)===!1,!D.stop&&(this.preorderTraversalAux(R.leftCh,F,D),!D.stop&&this.preorderTraversalAux(R.rightCh,F,D)))},B.prototype.postorderTraversalAux=function(R,F,D){R===null||D.stop||(this.postorderTraversalAux(R.leftCh,F,D),!D.stop&&(this.postorderTraversalAux(R.rightCh,F,D),!D.stop&&(D.stop=F(R.element)===!1)))},B.prototype.minimumAux=function(R){for(;R!=null&&R.leftCh!==null;)R=R.leftCh;return R},B.prototype.maximumAux=function(R){for(;R!=null&&R.rightCh!==null;)R=R.rightCh;return R},B.prototype.heightAux=function(R){return R===null?-1:Math.max(this.heightAux(R.leftCh),this.heightAux(R.rightCh))+1},B.prototype.insertNode=function(R){for(var F=null,D=this.root;D!==null;){var G=this.compare(R.element,D.element);if(G===0)return null;G<0?(F=D,D=D.leftCh):(F=D,D=D.rightCh)}return R.parent=F,F===null?this.root=R:this.compare(R.element,F.element)<0?F.leftCh=R:F.rightCh=R,R},B.prototype.createNode=function(R){return{element:R,leftCh:null,rightCh:null,parent:null}},B}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal$1&&commonjsGlobal$1.__extends||function(){var B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,F){R.__proto__=F}||function(R,F){for(var D in F)F.hasOwnProperty(D)&&(R[D]=F[D])};return function(R,F){B(R,F);function D(){this.constructor=R}R.prototype=F===null?Object.create(F):(D.prototype=F.prototype,new D)}}();Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(B){__extends$2(R,B);function R(){return B!==null&&B.apply(this,arguments)||this}return R}(BSTreeKV_1$1.default);BSTree$1.default=BSTree;var Heap$1={};Object.defineProperty(Heap$1,"__esModule",{value:!0});var collections=util$a,arrays$1=arrays$4,Heap=function(){function B(R){this.data=[],this.compare=R||collections.defaultCompare}return B.prototype.leftChildIndex=function(R){return 2*R+1},B.prototype.rightChildIndex=function(R){return 2*R+2},B.prototype.parentIndex=function(R){return Math.floor((R-1)/2)},B.prototype.minIndex=function(R,F){return F>=this.data.length?R>=this.data.length?-1:R:this.compare(this.data[R],this.data[F])<=0?R:F},B.prototype.siftUp=function(R){for(var F=this.parentIndex(R);R>0&&this.compare(this.data[F],this.data[R])>0;)arrays$1.swap(this.data,F,R),R=F,F=this.parentIndex(R)},B.prototype.siftDown=function(R){for(var F=this.minIndex(this.leftChildIndex(R),this.rightChildIndex(R));F>=0&&this.compare(this.data[R],this.data[F])>0;)arrays$1.swap(this.data,F,R),R=F,F=this.minIndex(this.leftChildIndex(R),this.rightChildIndex(R))},B.prototype.peek=function(){if(this.data.length>0)return this.data[0]},B.prototype.add=function(R){return collections.isUndefined(R)?!1:(this.data.push(R),this.siftUp(this.data.length-1),!0)},B.prototype.removeRoot=function(){if(this.data.length>0){var R=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),R}},B.prototype.contains=function(R){var F=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,R,F)},B.prototype.size=function(){return this.data.length},B.prototype.isEmpty=function(){return this.data.length<=0},B.prototype.clear=function(){this.data.length=0},B.prototype.forEach=function(R){arrays$1.forEach(this.data,R)},B}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal$1&&commonjsGlobal$1.__extends||function(){var B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,F){R.__proto__=F}||function(R,F){for(var D in F)F.hasOwnProperty(D)&&(R[D]=F[D])};return function(R,F){B(R,F);function D(){this.constructor=R}R.prototype=F===null?Object.create(F):(D.prototype=F.prototype,new D)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$3=util$a,LinkedDictionaryPair=function(){function B(R,F){this.key=R,this.value=F}return B.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},B}(),HeadOrTailLinkedDictionaryPair=function(){function B(){this.key=null,this.value=null}return B.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},B}();function isHeadOrTailLinkedDictionaryPair(B){return!B.next}var LinkedDictionary=function(B){__extends$1(R,B);function R(F){var D=B.call(this,F)||this;return D.head=new HeadOrTailLinkedDictionaryPair,D.tail=new HeadOrTailLinkedDictionaryPair,D.head.next=D.tail,D.tail.prev=D.head,D}return R.prototype.appendToTail=function(F){var D=this.tail.prev;D.next=F,F.prev=D,F.next=this.tail,this.tail.prev=F},R.prototype.getLinkedDictionaryPair=function(F){if(!util$3.isUndefined(F)){var D="$"+this.toStr(F),G=this.table[D];return G}},R.prototype.getValue=function(F){var D=this.getLinkedDictionaryPair(F);if(!util$3.isUndefined(D))return D.value},R.prototype.remove=function(F){var D=this.getLinkedDictionaryPair(F);if(!util$3.isUndefined(D))return B.prototype.remove.call(this,F),D.unlink(),D.value},R.prototype.clear=function(){B.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},R.prototype.replace=function(F,D){var G="$"+this.toStr(D.key);D.next=F.next,D.prev=F.prev,this.remove(F.key),D.prev.next=D,D.next.prev=D,this.table[G]=D,++this.nElements},R.prototype.setValue=function(F,D){if(!(util$3.isUndefined(F)||util$3.isUndefined(D))){var G=this.getLinkedDictionaryPair(F),U=new LinkedDictionaryPair(F,D),W="$"+this.toStr(F);if(util$3.isUndefined(G)){this.appendToTail(U),this.table[W]=U,++this.nElements;return}else return this.replace(G,U),G.value}},R.prototype.keys=function(){var F=[];return this.forEach(function(D,G){F.push(D)}),F},R.prototype.values=function(){var F=[];return this.forEach(function(D,G){F.push(G)}),F},R.prototype.forEach=function(F){for(var D=this.head.next;!isHeadOrTailLinkedDictionaryPair(D);){var G=F(D.key,D.value);if(G===!1)return;D=D.next}},R}(Dictionary_1$3.default);LinkedDictionary$1.default=LinkedDictionary;var MultiDictionary$1={};Object.defineProperty(MultiDictionary$1,"__esModule",{value:!0});var util$2=util$a,Dictionary_1$2=Dictionary$2,arrays=arrays$4,MultiDictionary=function(){function B(R,F,D){D===void 0&&(D=!1),this.dict=new Dictionary_1$2.default(R),this.equalsF=F||util$2.defaultEquals,this.allowDuplicate=D}return B.prototype.getValue=function(R){var F=this.dict.getValue(R);return util$2.isUndefined(F)?[]:arrays.copy(F)},B.prototype.setValue=function(R,F){if(util$2.isUndefined(R)||util$2.isUndefined(F))return!1;var D=this.dict.getValue(R);return util$2.isUndefined(D)?(this.dict.setValue(R,[F]),!0):!this.allowDuplicate&&arrays.contains(D,F,this.equalsF)?!1:(D.push(F),!0)},B.prototype.remove=function(R,F){if(util$2.isUndefined(F)){var D=this.dict.remove(R);return!util$2.isUndefined(D)}var G=this.dict.getValue(R);return!util$2.isUndefined(G)&&arrays.remove(G,F,this.equalsF)?(G.length===0&&this.dict.remove(R),!0):!1},B.prototype.keys=function(){return this.dict.keys()},B.prototype.values=function(){for(var R=this.dict.values(),F=[],D=0,G=R;D-1&&this.insertIdIntoRoot(F,D);for(var G in this.nodes)if(this.nodes.hasOwnProperty(G)){var U=this.findNodeId(G,R);U>-1&&this.insertIdIntoNode(G,F,U)}},B.prototype.insertIdAfterId=function(R,F){var D=this.findRootId(R);D>-1&&this.insertIdIntoRoot(F,D+1);for(var G in this.nodes)if(this.nodes.hasOwnProperty(G)){var U=this.findNodeId(G,R);U>-1&&this.insertIdIntoNode(G,F,U+1)}},B.prototype.insertIdIntoId=function(R,F){this.nodeInsertAtEnd(R,F),this.nodes[F]=[]},B.prototype.insertIdIntoRoot=function(R,F){if(F===void 0)this.rootInsertAtEnd(R);else if(F<0){var D=this.rootIds.length;this.rootIds.splice(F+D+1,0,R)}else this.rootIds.splice(F,0,R);this.nodes[R]=this.nodes[R]||[]},B.prototype.insertIdIntoNode=function(R,F,D){if(this.nodes[R]=this.nodes[R]||[],this.nodes[F]=this.nodes[F]||[],D===void 0)this.nodeInsertAtEnd(R,F);else if(D<0){var G=this.nodes[R].length;this.nodes[R].splice(D+G+1,0,F)}else this.nodes[R].splice(D,0,F)},B.prototype.moveId=function(R,F,D){var G=R,U=this.findRootId(G);this.nodes[F];for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){this.findNodeId(W,F);break}var q=F,Y=this.findRootId(q);this.nodes[F];for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){this.findNodeId(W,F);break}if(U>-1)if(Y>-1)switch(this.rootDelete(U),Y>U&&Y--,D){case Direction.BEFORE:this.insertIdIntoRoot(G,Y);break;case Direction.AFTER:this.insertIdIntoRoot(G,Y+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(q,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(q,G);break}else{this.rootDelete(U);for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){var K=this.findNodeId(W,q);if(K>-1){switch(D){case Direction.BEFORE:this.insertIdIntoNode(W,G,K);break;case Direction.AFTER:this.insertIdIntoNode(W,G,K+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(q,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(q,G);break}break}}}else if(Y>-1){for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){var K=this.findNodeId(W,G);if(K>-1){this.nodeDeleteAtIndex(W,K);break}}switch(D){case Direction.BEFORE:this.insertIdIntoRoot(G,Y);break;case Direction.AFTER:this.insertIdIntoRoot(G,Y+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(q,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(q,G);break}}else{for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){var K=this.findNodeId(W,G);if(K>-1){this.nodeDeleteAtIndex(W,K);break}}for(var W in this.nodes)if(this.nodes.hasOwnProperty(W)){var K=this.findNodeId(W,q);if(K>-1){switch(D){case Direction.BEFORE:this.insertIdIntoNode(W,G,K);break;case Direction.AFTER:this.insertIdIntoNode(W,G,K+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(q,G);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(q,G);break}break}}}},B.prototype.swapArrayElements=function(R,F,D){var G=R[F];return R[F]=R[D],R[D]=G,R},B.prototype.rootDeleteId=function(R){var F=this.findRootId(R);F>-1&&this.rootDelete(F)},B.prototype.nodeAndSubNodesDelete=function(R){for(var F=[],D=0;D(B[B.pppppp=0]="pppppp",B[B.ppppp=1]="ppppp",B[B.pppp=2]="pppp",B[B.ppp=3]="ppp",B[B.pp=4]="pp",B[B.p=5]="p",B[B.mp=6]="mp",B[B.mf=7]="mf",B[B.f=8]="f",B[B.ff=9]="ff",B[B.fff=10]="fff",B[B.ffff=11]="ffff",B[B.fffff=12]="fffff",B[B.ffffff=13]="ffffff",B[B.sf=14]="sf",B[B.sff=15]="sff",B[B.sfp=16]="sfp",B[B.sfpp=17]="sfpp",B[B.fp=18]="fp",B[B.rf=19]="rf",B[B.rfz=20]="rfz",B[B.sfz=21]="sfz",B[B.sffz=22]="sffz",B[B.fz=23]="fz",B[B.other=24]="other",B))(DynamicEnum||{});InstantaneousDynamicExpression.staticConstructor();class DynamicsContainer{constructor(R,F){R instanceof ContinuousDynamicExpression?this.continuousDynamicExpression=R:R instanceof InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=R),this.staffNumber=F}static Compare(R,F){return R.parMultiExpression().AbsoluteTimestamp.CompareTo(F.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}}class AbstractNotationInstruction{constructor(R){this.printObject=!0,this.parent=R}get Parent(){return this.parent}set Parent(R){this.parent=R}get PrintObject(){return this.printObject}set PrintObject(R){this.printObject=R}}class RhythmInstruction extends AbstractNotationInstruction{constructor(R,F){super(void 0),this.rhythm=R,this.numerator=R.Numerator,this.denominator=R.Denominator,this.symbolEnum=F}get Rhythm(){return this.rhythm}set Rhythm(R){this.rhythm=R}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(R){this.symbolEnum=R}clone(){return new RhythmInstruction(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(R){const F=this;return F===R?!0:!F||!R?!1:F.numerator===R.numerator&&F.denominator===R.denominator}OperatorNotEqual(R){return this!==R}ToString(){return"Rhythm: "+this.rhythm.toString()}}var RhythmSymbolEnum=(B=>(B[B.NONE=0]="NONE",B[B.COMMON=1]="COMMON",B[B.CUT=2]="CUT",B))(RhythmSymbolEnum||{});class MusicPartManagerIterator{constructor(R,F,D){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new Fraction$1(0,1),this.currentEnrolledMeasureTimestamp=new Fraction$1(0,1),this.currentRelativeInMeasureTimestamp=new Fraction$1(0,1),this.currentVerticalContainerInMeasureTimestamp=new Fraction$1(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=R,this.currentBpm=R.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const G of this.musicSheet.Repetitions)this.setRepetitionIterationCount(G,1);for(let G=0;G=this.JumpResponsibleRepetition.StartIndex&&G.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(G)}}handleRepetitionsAtMeasureEnd(){for(let R=0,F=this.currentMeasure.LastRepetitionInstructions.length;R-1&&this.getRepetitionIterationCount(G)=this.JumpResponsibleRepetition.StartIndex&&G.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(G),this.repetitionIterationCountDictKeys.contains(G))){const U=G.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(G));if(U>=0){this.currentMeasureIndex=U,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=G,this.forwardJumpOccurred=!0;return}U===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(R){this.currentMeasureIndex=R.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(R),this.jumpResponsibleRepetition=R,this.backJumpOccurred=!0}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const R=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let F=0,D=R.length;F0&&(this.currentDynamicEntryIndex>=R.length||R[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=F.length||F[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!R)return!0;for(let D=0,G=F.length;DF&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[F].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>D){const U=this.openSheetMusicDisplay.Sheet.SourceMeasures[D];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(U.AbsoluteTimestamp,U.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(R){const F=R.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,D=R.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(D,F,R.ParentSourceStaffEntry)}updateWithTimestamp(R){const F=this.manager.absoluteEnrolledToSheetTimestamp(R),D=this.graphic.calculateXPositionFromTimestamp(F),G=D[0],U=D[1];this.updateCurrentPageFromSystem(U);const W=D[2];if(!W)return;const q=Math.max(W.parentMeasure.MeasureNumber,1);let Y;for(const Q of this.graphic.MeasureList[q-1])if(Q){Y=Q;break}const K=this.graphic.calculateCursorPoints(G,U),Z=K[0].y,j=K[1].y-Z;if(!!Y){if(this.updateWidthAndStyle(Y.PositionAndShape,G,Z,j),this.openSheetMusicDisplay.FollowCursor){const Q=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:Q<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const R=this.Iterator,F=R.CurrentVisibleVoiceEntries();if(R.EndReached||!R.CurrentVoiceEntries||F.length===0)return;let D=0,G=0,U=0,W;if(R.CurrentMeasure.isReducedToMultiRest){const Z=this.graphic.findGraphicalMeasure(R.CurrentMeasureIndex,0),j=Z.parentSourceMeasure.multipleRestMeasures,J=R.CurrentMeasure.multipleRestMeasureNumber/(j+1),te=Z.PositionAndShape.Size.width-Z.beginInstructionsWidth;D=Z.PositionAndShape.AbsolutePosition.x+Z.beginInstructionsWidth+J*te,W=Z.ParentMusicSystem}else{const j=F.map(Q=>this.getStaffEntryFromVoiceEntry(Q)).sort((Q,J)=>{var te,ne,ie,re;return((ne=(te=Q==null?void 0:Q.PositionAndShape)==null?void 0:te.AbsolutePosition)==null?void 0:ne.x)<=((re=(ie=J==null?void 0:J.PositionAndShape)==null?void 0:ie.AbsolutePosition)==null?void 0:re.x)?-1:1})[0];j&&(D=j.PositionAndShape.AbsolutePosition.x,W=j.parentMeasure.ParentMusicSystem)}if(!W)return;G=W.PositionAndShape.AbsolutePosition.y+W.StaffLines[0].PositionAndShape.RelativePosition.y;const q=W.StaffLines[W.StaffLines.length-1];U=W.PositionAndShape.AbsolutePosition.y+q.PositionAndShape.RelativePosition.y+q.StaffHeight-G;const K=this.graphic.findGraphicalMeasure(R.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(K,D,G,U),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const Z=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:Z<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}updateWidthAndStyle(R,F,D,G){const U=this.cursorElement;let W=0,q=G;switch(this.cursorOptions.type){case 1:U.style.top=D*10*this.openSheetMusicDisplay.zoom+"px",U.style.left=(F-1.5)*10*this.openSheetMusicDisplay.zoom+"px",q=G*10*this.openSheetMusicDisplay.zoom,U.height=q,U.style.height=q+"px",W=5*this.openSheetMusicDisplay.zoom;break;case 2:U.style.top=(D-2.5)*10*this.openSheetMusicDisplay.zoom+"px",U.style.left=F*10*this.openSheetMusicDisplay.zoom+"px",q=1.5*10*this.openSheetMusicDisplay.zoom,U.height=q,U.style.height=q+"px",W=5*this.openSheetMusicDisplay.zoom;break;case 3:U.style.top=R.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",U.style.left=R.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",q=G*10*this.openSheetMusicDisplay.zoom,U.height=q,U.style.height=q+"px",W=R.Size.width*10*this.openSheetMusicDisplay.zoom;break;case 4:U.style.top=R.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",U.style.left=R.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",q=G*10*this.openSheetMusicDisplay.zoom,U.height=q,U.style.height=q+"px",W=(F-R.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:U.style.top=D*10*this.openSheetMusicDisplay.zoom+"px",U.style.left=(F-1.5)*10*this.openSheetMusicDisplay.zoom+"px",q=G*10*this.openSheetMusicDisplay.zoom,U.height=q,U.style.height=q+"px",W=3*10*this.openSheetMusicDisplay.zoom;break}W!==U.width&&(U.width=W,this.updateStyle(W,this.cursorOptions))}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator();const R=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(R.CurrentEnrolledTimestamp)}updateStyle(R,F=void 0){F!==void 0&&(this.cursorOptions=F);const D=document.createElement("canvas");D.width=this.cursorElement.width,D.height=1;const G=D.getContext("2d");G.globalAlpha=this.cursorOptions.alpha;const U=G.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:U.addColorStop(1,this.cursorOptions.color);break;default:U.addColorStop(0,"white"),U.addColorStop(.2,this.cursorOptions.color),U.addColorStop(.8,this.cursorOptions.color),U.addColorStop(1,"white");break}G.fillStyle=U,G.fillRect(0,0,R,1),this.cursorElement.src=D.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(R){return this.Iterator.CurrentVisibleVoiceEntries(R)}NotesUnderCursor(R){const F=this.VoicesUnderCursor(R),D=[];return F.forEach(G=>{D.push.apply(D,G.Notes)}),D}GNotesUnderCursor(R){const F=this.VoicesUnderCursor(R),D=[];return F.forEach(G=>{D.push(...G.Notes.map(U=>this.rules.GNote(U)))}),D}updateCurrentPage(){const R=this.Iterator.currentTimeStamp;for(const F of this.graphic.MusicPages)if(F.MusicSystems.last().GetSystemsLastTimeStamp().gt(R)){const G=F.PageNumber;return G!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+G),this.container.appendChild(this.cursorElement)),this.currentPageNumber=G}return 1}updateCurrentPageFromSystem(R){if(R!=null&&R.Parent){const F=R.Parent.PageNumber;return F!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+F),this.container.appendChild(this.cursorElement)),this.currentPageNumber=F}return 1}}class PointF2D{constructor(R=0,F=0){this.x=0,this.y=0,this.x=R,this.y=F}static get Empty(){return new PointF2D}static pointsAreEqual(R,F){return R.x===F.x&&R.y===F.y}ToString(){return"["+this.x+", "+this.y+"]"}}class SizeF2D{constructor(R=0,F=0){this.width=R,this.height=F}}class RectangleF2D{constructor(R,F,D,G){this.x=0,this.y=0,this.width=0,this.height=0,this.x=R,this.y=F,this.width=D,this.height=G}static createFromLocationAndSize(R,F){return new RectangleF2D(R.x,R.y,F.width,F.height)}get Location(){return new PointF2D(this.x,this.y)}get Size(){return new SizeF2D(this.width,this.height)}}class AClassHierarchyTrackable{isInstanceOfClass(R){let F=this.constructor.prototype;for(;F;){if(R===F.constructor.name)return!0;F=F.__proto__}return!1}}class GraphicalObject extends AClassHierarchyTrackable{get PositionAndShape(){return this.boundingBox}set PositionAndShape(R){this.boundingBox=R}}class StaffLineActivitySymbol extends GraphicalObject{constructor(R){super(),this.parentStaffLine=R;const F=R.PositionAndShape;this.boundingBox=new BoundingBox$2(this,F),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}class Clickable extends GraphicalObject{}class BoundingBox$2{constructor(R=void 0,F=void 0,D=!1){this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new PointF2D,this.relativePosition=new PointF2D,this.size=new SizeF2D,this.marginSize=new SizeF2D,this.upperLeftCorner=new PointF2D,this.upperLeftMarginCorner=new PointF2D,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=F,this.dataObject=R,this.isSymbol=D,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,F&&(this.Parent=F)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(R){this.xBordersHaveBeenSet=R}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(R){this.yBordersHaveBeenSet=R}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(R){this.absolutePosition=R}get RelativePosition(){return this.relativePosition}set RelativePosition(R){this.relativePosition=R,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(R){this.size=R}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(R){this.borderLeft=R,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(R){this.borderRight=R,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(R){this.borderTop=R,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(R){this.borderBottom=R,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(R){this.borderMarginLeft=R,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(R){this.borderMarginTop=R,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(W,1)}this.parent=R,((D=(F=this.parent)==null?void 0:F.ChildElements)==null?void 0:D.indexOf(this))>-1?log$2.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(U=(G=this.parent)==null?void 0:G.ChildElements)==null||U.push(this)}get DataObject(){return this.dataObject}get Center(){return new PointF2D(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}setAbsolutePositionFromParent(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}calculateAbsolutePosition(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;let R=this.parent;for(;R;)this.absolutePosition.x+=R.relativePosition.x,this.absolutePosition.y+=R.relativePosition.y,R=R.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let R=0,F=this.ChildElements.length;R.001;break;case ColDirEnum.Up:case ColDirEnum.Down:G=this.relativePosition.y,R.calculateMarginPositionAlongDirection(this,F),U=Math.abs(G-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}while(U)}collisionDetection(R){const F=Math.min(this.AbsolutePosition.x+this.borderRight,R.absolutePosition.x+R.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,R.absolutePosition.x+R.borderLeft),D=Math.min(this.AbsolutePosition.y+this.borderBottom,R.absolutePosition.y+R.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,R.absolutePosition.y+R.borderTop);return F>0&&D>0}liesInsideBorders(R){const F=this.AbsolutePosition.x+this.borderLeft<=R.absolutePosition.x+R.borderLeft&&R.absolutePosition.x+R.borderLeft<=this.AbsolutePosition.x+this.borderRight,D=this.AbsolutePosition.x+this.borderLeft<=R.absolutePosition.x+R.borderRight&&R.absolutePosition.x+R.borderRight<=this.AbsolutePosition.x+this.borderRight;if(F&&D){const G=this.AbsolutePosition.y+this.borderTop<=R.absolutePosition.y+R.borderTop&&R.absolutePosition.y+R.borderTop<=this.AbsolutePosition.y+this.borderBottom,U=this.AbsolutePosition.y+this.borderTop<=R.absolutePosition.y+R.borderBottom&&R.absolutePosition.y+R.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(G&&U)return!0}return!1}pointLiesInsideBorders(R){return this.AbsolutePosition.x+this.borderLeft<=R.x&&R.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=R.y&&R.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(R){const F=Math.min(this.AbsolutePosition.x+this.borderMarginRight,R.absolutePosition.x+R.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,R.absolutePosition.x+R.borderMarginLeft),D=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,R.absolutePosition.y+R.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,R.absolutePosition.y+R.borderMarginTop);return F>0&&D>0}liesInsideMargins(R){const F=this.AbsolutePosition.x+this.borderMarginLeft<=R.absolutePosition.x+R.borderMarginLeft&&R.absolutePosition.x+R.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,D=this.AbsolutePosition.x+this.borderMarginLeft<=R.absolutePosition.x+R.borderMarginRight&&R.absolutePosition.x+R.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(F&&D){const G=this.AbsolutePosition.y+this.borderMarginTop<=R.absolutePosition.y+R.borderMarginTop&&R.absolutePosition.y+R.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,U=this.AbsolutePosition.y+this.borderMarginTop<=R.absolutePosition.y+R.borderMarginBottom&&R.absolutePosition.y+R.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(G&&U)return!0}return!1}pointLiesInsideMargins(R){return this.AbsolutePosition.x+this.borderMarginLeft<=R.x&&R.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=R.y&&R.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(R,F,D){this.RelativePosition=new PointF2D(D.x,D.y),this.setAbsolutePositionFromParent();let G=0,U=!1;do switch(F){case ColDirEnum.Left:case ColDirEnum.Right:G=this.relativePosition.x,R.calculatePositionAlongDirection(this,F),U=Math.abs(G-this.relativePosition.x)>1e-4;break;case ColDirEnum.Up:case ColDirEnum.Down:G=this.relativePosition.y,R.calculatePositionAlongDirection(this,F),U=Math.abs(G-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}while(U)}getClickedObjectOfType(R){const F=this.dataObject;if(this.pointLiesInsideBorders(R)&&F)return F;for(let D=0,G=this.childElements.length;D(B[B.Left=0]="Left",B[B.Right=1]="Right",B[B.Up=2]="Up",B[B.Down=3]="Down",B))(ColDirEnum||{});class GraphicalMusicPage extends GraphicalObject{constructor(R){super(),this.musicSystems=[],this.labels=[],this.parent=R,this.boundingBox=new BoundingBox$2(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(R){this.musicSystems=R}get Labels(){return this.labels}set Labels(R){this.labels=R}get Parent(){return this.parent}set Parent(R){this.parent=R}get PageNumber(){return this.pageNumber}set PageNumber(R){this.pageNumber=R}setMusicPageAbsolutePosition(R,F){return new PointF2D(0,0)}}var PagePlacementEnum=(B=>(B[B.Down=0]="Down",B[B.Right=1]="Right",B[B.RightDown=2]="RightDown",B))(PagePlacementEnum||{}),TextAlignmentEnum=(B=>(B[B.LeftTop=0]="LeftTop",B[B.LeftCenter=1]="LeftCenter",B[B.LeftBottom=2]="LeftBottom",B[B.CenterTop=3]="CenterTop",B[B.CenterCenter=4]="CenterCenter",B[B.CenterBottom=5]="CenterBottom",B[B.RightTop=6]="RightTop",B[B.RightCenter=7]="RightCenter",B[B.RightBottom=8]="RightBottom",B))(TextAlignmentEnum||{});class TextAlignment{static IsLeft(R){return R===0||R===1||R===2}static IsCenterAligned(R){return R===3||R===4||R===5}static IsRight(R){return R===6||R===7||R===8}}var FontStyles=(B=>(B[B.Regular=0]="Regular",B[B.Bold=1]="Bold",B[B.Italic=2]="Italic",B[B.BoldItalic=3]="BoldItalic",B[B.Underlined=4]="Underlined",B))(FontStyles||{}),Fonts=(B=>(B[B.TimesNewRoman=0]="TimesNewRoman",B[B.Kokila=1]="Kokila",B[B.Gonville=2]="Gonville",B))(Fonts||{});const FontStringNames={0:"Times New Roman",1:"Kokila",2:"Gonville"};var TieTypes=(B=>(B.SIMPLE="",B.HAMMERON="H",B.PULLOFF="P",B.SLIDE="S",B.TAPPING="T",B))(TieTypes||{});const Additional={"-2":[4,12,23],"-7":[13],"-9":[6]};var NoteEnum=(B=>(B[B.C=0]="C",B[B.D=2]="D",B[B.E=4]="E",B[B.F=5]="F",B[B.G=7]="G",B[B.A=9]="A",B[B.B=11]="B",B))(NoteEnum||{}),AccidentalEnum=(B=>(B[B.SHARP=0]="SHARP",B[B.FLAT=1]="FLAT",B[B.NONE=2]="NONE",B[B.NATURAL=3]="NATURAL",B[B.DOUBLESHARP=4]="DOUBLESHARP",B[B.DOUBLEFLAT=5]="DOUBLEFLAT",B[B.TRIPLESHARP=6]="TRIPLESHARP",B[B.TRIPLEFLAT=7]="TRIPLEFLAT",B[B.QUARTERTONESHARP=8]="QUARTERTONESHARP",B[B.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",B[B.SLASHFLAT=10]="SLASHFLAT",B[B.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",B[B.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",B[B.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",B[B.SLASHSHARP=14]="SLASHSHARP",B[B.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",B[B.SORI=16]="SORI",B[B.KORON=17]="KORON",B))(AccidentalEnum||{});const _Pitch=class{constructor(B,R,F,D=void 0){this.accidental=2,this.fundamentalNote=B,this.octave=R,this.accidental=F,this.accidentalXml=D,this.halfTone=B+(R+_Pitch.octXmlDiff)*12+_Pitch.HalfTonesFromAccidental(F),this.frequency=_Pitch.calcFrequency(this),this.nextFrequency=_Pitch.calcFrequency(this,"next"),this.prevFrequency=_Pitch.calcFrequency(this,"prev")}static getNoteEnumString(B){switch(B){case 0:return"C";case 2:return"D";case 4:return"E";case 5:return"F";case 7:return"G";case 9:return"A";case 11:return"B";default:return""}}static lineShiftFromNoteEnum(B,R){if(R===0)return[B,0];const F=_Pitch.pitchEnumValues,D=F.indexOf(B);let G=0,U=(D+R)%F.length;return D+R>F.length-1&&(G=1),U<0&&(U=F.length+U,G=-1),[F[U],G]}static CalculateTransposedHalfTone(B,R){const F=B.fundamentalNote+B.AccidentalHalfTones+R;return _Pitch.WrapAroundCheck(F,12)}static WrapAroundCheck(B,R){let F=0;for(;B<0;)B+=R,F--;for(;B>=R;)B-=R,F++;return{overflow:F,halftone:B}}static calcFrequency(B,R){let F=0,D;if(B instanceof _Pitch){const q=B;F=q.octave-1,D=q.fundamentalNote-9+q.AccidentalHalfTones}else typeof B=="number"&&(D=B-57);const G=window.DYSubjectId;let U=0;window.DYEnvironment==="COLEXIU"&&(Additional[12]=[120]);for(const q in Additional)if(Object.prototype.hasOwnProperty.call(Additional,q)&&Additional[q].includes(G)){U=parseFloat(q);break}let W=D+U;return R==="next"&&W++,R==="prev"&&W--,442*Math.pow(2,F)*Math.pow(2,W/12)}static calcFractionalKey(B){return Math.log(B/440)/Math.LN10*_Pitch.halftoneFactor+57}static fromFrequency(B){const R=_Pitch.calcFractionalKey(B)+.5,F=Math.floor(R/12)-_Pitch.octXmlDiff,D=Math.floor(R)%12;let G=D,U=2;return this.pitchEnumValues.indexOf(G)===-1&&(G=D-1,U=0),new _Pitch(G,F,U)}static fromHalftone(B){const R=Math.floor(B/12)-_Pitch.octXmlDiff,F=B%12;let D=F,G=2;return this.pitchEnumValues.indexOf(D)===-1&&(D=F-1,G=0),new _Pitch(D,R,G)}static ceiling(B){B=B%12;let R=B;return this.pitchEnumValues.indexOf(R)===-1&&(R=B+1),R}static floor(B){B=B%12;let R=B;return this.pitchEnumValues.indexOf(R)===-1&&(R=B-1),R}static HalfTonesFromAccidental(B){switch(B){case 2:return 0;case 0:return 1;case 1:return-1;case 3:return 0;case 4:return 2;case 5:return-2;case 6:return 3;case 7:return-3;case 8:return .5;case 9:return-.5;case 10:return-.51;case 11:return 1.5;case 12:return-1.5;case 13:return .0013;case 14:return .0014;case 15:return-.0015;case 16:return .0016;case 17:return .0017;default:throw new Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(B){switch(B){case 0:return 2;case 1:return 0;case-1:return 1;case 2:return 4;case-2:return 5;case 3:return 6;case-3:return 7;case .5:return 8;case-.5:return 9;case 1.5:return 11;case-1.5:return 12;default:return B>0&&B<1?8:B<0&&B>-1?9:8}}static accidentalVexflow(B){let R;switch(B){case 3:R="n";break;case 1:R="b";break;case 0:R="#";break;case 4:R="##";break;case 6:R="###";break;case 5:R="bb";break;case 7:R="bbs";break;case 8:R="+";break;case 9:R="d";break;case 10:R="bs";break;case 11:R="++";break;case 12:R="db";break;case 13:R="+-";break;case 14:R="++-";break;case 15:R="bss";break;case 16:R="o";break;case 17:R="k";break}return R}get AccidentalHalfTones(){return _Pitch.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return _Pitch.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(B){if(B>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return B>0?this.getHigherPitchByTransposeFactor(B):B<0?this.getLowerPitchByTransposeFactor(-B):this}DoEnharmonicChange(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;default:return}}ToString(){let B=_Pitch.accidentalVexflow(this.accidental);return B||(B=""),"Key: "+_Pitch.getNoteEnumString(this.fundamentalNote)+B+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(B){const R=this;return!R||!B?!1:R.FundamentalNote===B.FundamentalNote&&R.Octave===B.Octave&&R.Accidental===B.Accidental}OperatorNotEqual(B){return this!==B}OperatorFundamentalGreaterThan(B){const R=this;return R.Octave===B.Octave?R.FundamentalNote>B.FundamentalNote:R.Octave>B.Octave}OperatorFundamentalLessThan(B){const R=this;return R.Octave===B.Octave?R.FundamentalNote_Pitch.pitchEnumValues.length-1?(D=_Pitch.pitchEnumValues[R+B-_Pitch.pitchEnumValues.length],F++):D=_Pitch.pitchEnumValues[R+B],new _Pitch(D,F,2)}getLowerPitchByTransposeFactor(B){const R=_Pitch.pitchEnumValues.indexOf(this.fundamentalNote);let F=this.octave,D;return R-B<0?(D=_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length+R-B],F--):D=_Pitch.pitchEnumValues[R-B],new _Pitch(D,F,2)}getNextFundamentalNote(B){let R=_Pitch.pitchEnumValues.indexOf(B);return R=(R+1)%_Pitch.pitchEnumValues.length,_Pitch.pitchEnumValues[R]}getPreviousFundamentalNote(B){const R=_Pitch.pitchEnumValues.indexOf(B);return R>0?_Pitch.pitchEnumValues[R-1]:_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length-1]}};let Pitch=_Pitch;Pitch.pitchEnumValues=[0,2,4,5,7,9,11];Pitch.halftoneFactor=12/(Math.LN2/Math.LN10);Pitch.octXmlDiff=3;class VerticalGraphicalStaffEntryContainer{constructor(R,F){this.staffEntries=[],this.absoluteTimestamp=F,this.staffEntries=new Array(R)}get Index(){return this.index}set Index(R){this.index=R}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(R){this.staffEntries=R}static compareByTimestamp(R,F){const D=R.absoluteTimestamp.RealValue,G=F.absoluteTimestamp.RealValue;return DG?1:0}getFirstNonNullStaffEntry(){for(let R=0,F=this.staffEntries.length;R(B[B.BaseWritingColor=0]="BaseWritingColor",B[B.FollowingCursor=1]="FollowingCursor",B[B.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",B[B.PlaybackCursor=3]="PlaybackCursor",B[B.Highlighted=4]="Highlighted",B[B.ErrorUnderlay=5]="ErrorUnderlay",B[B.Selected=6]="Selected",B[B.SelectionSymbol=7]="SelectionSymbol",B[B.DebugColor1=8]="DebugColor1",B[B.DebugColor2=9]="DebugColor2",B[B.DebugColor3=10]="DebugColor3",B[B.SplitScreenDivision=11]="SplitScreenDivision",B[B.GreyTransparentOverlay=12]="GreyTransparentOverlay",B[B.MarkedArea1=13]="MarkedArea1",B[B.MarkedArea2=14]="MarkedArea2",B[B.MarkedArea3=15]="MarkedArea3",B[B.MarkedArea4=16]="MarkedArea4",B[B.MarkedArea5=17]="MarkedArea5",B[B.MarkedArea6=18]="MarkedArea6",B[B.MarkedArea7=19]="MarkedArea7",B[B.MarkedArea8=20]="MarkedArea8",B[B.MarkedArea9=21]="MarkedArea9",B[B.MarkedArea10=22]="MarkedArea10",B[B.Comment1=23]="Comment1",B[B.Comment2=24]="Comment2",B[B.Comment3=25]="Comment3",B[B.Comment4=26]="Comment4",B[B.Comment5=27]="Comment5",B[B.Comment6=28]="Comment6",B[B.Comment7=29]="Comment7",B[B.Comment8=30]="Comment8",B[B.Comment9=31]="Comment9",B[B.Comment10=32]="Comment10",B))(OutlineAndFillStyleEnum||{});const OUTLINE_AND_FILL_STYLE_DICT=new Dictionary;OUTLINE_AND_FILL_STYLE_DICT.setValue(0,"Thistle");OUTLINE_AND_FILL_STYLE_DICT.setValue(1,"Aqua");OUTLINE_AND_FILL_STYLE_DICT.setValue(2,"Azure");OUTLINE_AND_FILL_STYLE_DICT.setValue(3,"Bisque");OUTLINE_AND_FILL_STYLE_DICT.setValue(4,"CadetBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(5,"DarkBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(6,"DarkGoldenRod");OUTLINE_AND_FILL_STYLE_DICT.setValue(7,"BlanchedAlmond");OUTLINE_AND_FILL_STYLE_DICT.setValue(8,"Chartreuse");OUTLINE_AND_FILL_STYLE_DICT.setValue(9,"DarkGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(10,"DarkOrange");OUTLINE_AND_FILL_STYLE_DICT.setValue(11,"FireBrick");OUTLINE_AND_FILL_STYLE_DICT.setValue(12,"DarkSalmon");OUTLINE_AND_FILL_STYLE_DICT.setValue(13,"DarkSeaGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(14,"DarkOrchid");OUTLINE_AND_FILL_STYLE_DICT.setValue(15,"Aquamarine");OUTLINE_AND_FILL_STYLE_DICT.setValue(16,"DarkKhaki");OUTLINE_AND_FILL_STYLE_DICT.setValue(17,"ForestGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(18,"AliceBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(19,"DeepPink");OUTLINE_AND_FILL_STYLE_DICT.setValue(20,"Coral");OUTLINE_AND_FILL_STYLE_DICT.setValue(21,"DarkOliveGreen");OUTLINE_AND_FILL_STYLE_DICT.setValue(22,"Chocolate");OUTLINE_AND_FILL_STYLE_DICT.setValue(23,"DodgerBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(24,"Blue");OUTLINE_AND_FILL_STYLE_DICT.setValue(25,"Beige");OUTLINE_AND_FILL_STYLE_DICT.setValue(26,"Crimson");OUTLINE_AND_FILL_STYLE_DICT.setValue(27,"Fuchsia");OUTLINE_AND_FILL_STYLE_DICT.setValue(28,"Brown");OUTLINE_AND_FILL_STYLE_DICT.setValue(29,"BlanchedAlmond");OUTLINE_AND_FILL_STYLE_DICT.setValue(30,"CornflowerBlue");OUTLINE_AND_FILL_STYLE_DICT.setValue(31,"Cornsilk");OUTLINE_AND_FILL_STYLE_DICT.setValue(32,"DarkGrey");var GraphicalLayers=(B=>(B[B.Background=0]="Background",B[B.Highlight=1]="Highlight",B[B.MeasureError=2]="MeasureError",B[B.SelectionSymbol=3]="SelectionSymbol",B[B.Cursor=4]="Cursor",B[B.PSI_Debug=5]="PSI_Debug",B[B.Notes=6]="Notes",B[B.Comment=7]="Comment",B[B.Debug_above=8]="Debug_above",B))(GraphicalLayers||{}),NoteState=(B=>(B[B.Normal=0]="Normal",B[B.Selected=1]="Selected",B[B.Follow_Confirmed=2]="Follow_Confirmed",B[B.QFeedback_NotFound=3]="QFeedback_NotFound",B[B.QFeedback_OK=4]="QFeedback_OK",B[B.QFeedback_Perfect=5]="QFeedback_Perfect",B[B.Debug1=6]="Debug1",B[B.Debug2=7]="Debug2",B[B.Debug3=8]="Debug3",B))(NoteState||{}),AutoColorSet=(B=>(B.C="#d82c6b",B.D="#F89D15",B.E="#FFE21A",B.F="#4dbd5c",B.G="#009D96",B.A="#43469d",B.B="#76429c",B.Rest="#000000",B))(AutoColorSet||{});class GraphicalLine{constructor(R,F,D=0,G=OutlineAndFillStyleEnum.BaseWritingColor,U=void 0){this.start=R,this.end=F,this.width=D,this.styleId=G,this.colorHex=U}get Start(){return this.start}set Start(R){this.start=R}get End(){return this.end}set End(R){this.end=R}get Width(){return this.width}set Width(R){this.width=R}}class ClefInstruction extends AbstractNotationInstruction{constructor(R=ClefEnum.G,F=0,D=2){super(void 0),this.clefType=ClefEnum.G,this.line=2,this.octaveOffset=0,this.line=D,this.clefType=R,this.octaveOffset=F,this.calcParameters()}static getDefaultClefFromMidiInstrument(R){switch(R){case MidiInstrument.Acoustic_Grand_Piano:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Electric_Bass_finger:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Electric_Bass_pick:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Fretless_Bass:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Slap_Bass_1:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Slap_Bass_2:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Synth_Bass_1:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Synth_Bass_2:return new ClefInstruction(ClefEnum.F,0,4);case MidiInstrument.Contrabass:return new ClefInstruction(ClefEnum.F,0,4);default:return new ClefInstruction(ClefEnum.G,0,2)}}static getAllPossibleClefs(){const R=[];for(let F=0;F<=2;F++){const D=new ClefInstruction(ClefEnum.G,F,2);R.push(D)}for(let F=-2;F<=0;F++){const D=new ClefInstruction(ClefEnum.F,F,4);R.push(D)}return R}static isSupportedClef(R){switch(R){case ClefEnum.G:case ClefEnum.F:case ClefEnum.C:case ClefEnum.percussion:case ClefEnum.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(R){this.clefType=R}get Line(){return this.line}set Line(R){this.line=R}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(R){this.octaveOffset=R}get ClefPitch(){return this.clefPitch}set ClefPitch(R){this.clefPitch=R}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(R){this.referenceCyPosition=R}Equals(R){return this===R?!0:!this||!R?!1:this.clefPitch===R.clefPitch&&this.Line===R.Line}NotEqual(R){return!this.Equals(R)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case ClefEnum.G:this.clefPitch=new Pitch(NoteEnum.G,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case ClefEnum.F:this.clefPitch=new Pitch(NoteEnum.F,0+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case ClefEnum.C:this.clefPitch=new Pitch(NoteEnum.C,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case ClefEnum.percussion:this.clefPitch=new Pitch(NoteEnum.C,2,AccidentalEnum.NONE),this.referenceCyPosition=2;break;case ClefEnum.TAB:this.clefPitch=new Pitch(NoteEnum.G,0,AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new ArgumentOutOfRangeException("clefType")}}}var ClefEnum=(B=>(B[B.G=0]="G",B[B.F=1]="F",B[B.C=2]="C",B[B.percussion=3]="percussion",B[B.TAB=4]="TAB",B))(ClefEnum||{}),MidiInstrument=(B=>(B[B.None=-1]="None",B[B.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",B[B.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",B[B.Electric_Grand_Piano=2]="Electric_Grand_Piano",B[B.Honky_tonk_Piano=3]="Honky_tonk_Piano",B[B.Electric_Piano_1=4]="Electric_Piano_1",B[B.Electric_Piano_2=5]="Electric_Piano_2",B[B.Harpsichord=6]="Harpsichord",B[B.Clavinet=7]="Clavinet",B[B.Celesta=8]="Celesta",B[B.Glockenspiel=9]="Glockenspiel",B[B.Music_Box=10]="Music_Box",B[B.Vibraphone=11]="Vibraphone",B[B.Marimba=12]="Marimba",B[B.Xylophone=13]="Xylophone",B[B.Tubular_Bells=14]="Tubular_Bells",B[B.Dulcimer=15]="Dulcimer",B[B.Drawbar_Organ=16]="Drawbar_Organ",B[B.Percussive_Organ=17]="Percussive_Organ",B[B.Rock_Organ=18]="Rock_Organ",B[B.Church_Organ=19]="Church_Organ",B[B.Reed_Organ=20]="Reed_Organ",B[B.Accordion=21]="Accordion",B[B.Harmonica=22]="Harmonica",B[B.Tango_Accordion=23]="Tango_Accordion",B[B.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",B[B.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",B[B.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",B[B.Electric_Guitar_clean=27]="Electric_Guitar_clean",B[B.Electric_Guitar_muted=28]="Electric_Guitar_muted",B[B.Overdriven_Guitar=29]="Overdriven_Guitar",B[B.Distortion_Guitar=30]="Distortion_Guitar",B[B.Guitar_harmonics=31]="Guitar_harmonics",B[B.Acoustic_Bass=32]="Acoustic_Bass",B[B.Electric_Bass_finger=33]="Electric_Bass_finger",B[B.Electric_Bass_pick=34]="Electric_Bass_pick",B[B.Fretless_Bass=35]="Fretless_Bass",B[B.Slap_Bass_1=36]="Slap_Bass_1",B[B.Slap_Bass_2=37]="Slap_Bass_2",B[B.Synth_Bass_1=38]="Synth_Bass_1",B[B.Synth_Bass_2=39]="Synth_Bass_2",B[B.Violin=40]="Violin",B[B.Viola=41]="Viola",B[B.Cello=42]="Cello",B[B.Contrabass=43]="Contrabass",B[B.Tremolo_Strings=44]="Tremolo_Strings",B[B.Pizzicato_Strings=45]="Pizzicato_Strings",B[B.Orchestral_Harp=46]="Orchestral_Harp",B[B.Timpani=47]="Timpani",B[B.String_Ensemble_1=48]="String_Ensemble_1",B[B.String_Ensemble_2=49]="String_Ensemble_2",B[B.Synth_Strings_1=50]="Synth_Strings_1",B[B.Synth_Strings_2=51]="Synth_Strings_2",B[B.Choir_Aahs=52]="Choir_Aahs",B[B.Voice_Oohs=53]="Voice_Oohs",B[B.Synth_Voice=54]="Synth_Voice",B[B.Orchestra_Hit=55]="Orchestra_Hit",B[B.Trumpet=56]="Trumpet",B[B.Trombone=57]="Trombone",B[B.Tuba=58]="Tuba",B[B.Muted_Trumpet=59]="Muted_Trumpet",B[B.French_Horn=60]="French_Horn",B[B.Brass_Section=61]="Brass_Section",B[B.Synth_Brass_1=62]="Synth_Brass_1",B[B.Synth_Brass_2=63]="Synth_Brass_2",B[B.Soprano_Sax=64]="Soprano_Sax",B[B.Alto_Sax=65]="Alto_Sax",B[B.Tenor_Sax=66]="Tenor_Sax",B[B.Baritone_Sax=67]="Baritone_Sax",B[B.Oboe=68]="Oboe",B[B.English_Horn=69]="English_Horn",B[B.Bassoon=70]="Bassoon",B[B.Clarinet=71]="Clarinet",B[B.Piccolo=72]="Piccolo",B[B.Flute=73]="Flute",B[B.Recorder=74]="Recorder",B[B.Pan_Flute=75]="Pan_Flute",B[B.Blown_Bottle=76]="Blown_Bottle",B[B.Shakuhachi=77]="Shakuhachi",B[B.Whistle=78]="Whistle",B[B.Ocarina=79]="Ocarina",B[B.Lead_1_square=80]="Lead_1_square",B[B.Lead_2_sawtooth=81]="Lead_2_sawtooth",B[B.Lead_3_calliope=82]="Lead_3_calliope",B[B.Lead_4_chiff=83]="Lead_4_chiff",B[B.Lead_5_charang=84]="Lead_5_charang",B[B.Lead_6_voice=85]="Lead_6_voice",B[B.Lead_7_fifths=86]="Lead_7_fifths",B[B.Lead_8_bass_lead=87]="Lead_8_bass_lead",B[B.Pad_1_new_age=88]="Pad_1_new_age",B[B.Pad_2_warm=89]="Pad_2_warm",B[B.Pad_3_polysynth=90]="Pad_3_polysynth",B[B.Pad_4_choir=91]="Pad_4_choir",B[B.Pad_5_bowed=92]="Pad_5_bowed",B[B.Pad_6_metallic=93]="Pad_6_metallic",B[B.Pad_7_halo=94]="Pad_7_halo",B[B.Pad_8_sweep=95]="Pad_8_sweep",B[B.FX_1_rain=96]="FX_1_rain",B[B.FX_2_soundtrack=97]="FX_2_soundtrack",B[B.FX_3_crystal=98]="FX_3_crystal",B[B.FX_4_atmosphere=99]="FX_4_atmosphere",B[B.FX_5_brightness=100]="FX_5_brightness",B[B.FX_6_goblins=101]="FX_6_goblins",B[B.FX_7_echoes=102]="FX_7_echoes",B[B.FX_8_scifi=103]="FX_8_scifi",B[B.Sitar=104]="Sitar",B[B.Banjo=105]="Banjo",B[B.Shamisen=106]="Shamisen",B[B.Koto=107]="Koto",B[B.Kalimba=108]="Kalimba",B[B.Bag_pipe=109]="Bag_pipe",B[B.Fiddle=110]="Fiddle",B[B.Shanai=111]="Shanai",B[B.Tinkle_Bell=112]="Tinkle_Bell",B[B.Agogo=113]="Agogo",B[B.Steel_Drums=114]="Steel_Drums",B[B.Woodblock=115]="Woodblock",B[B.Taiko_Drum=116]="Taiko_Drum",B[B.Melodic_Tom=117]="Melodic_Tom",B[B.Synth_Drum=118]="Synth_Drum",B[B.Reverse_Cymbal=119]="Reverse_Cymbal",B[B.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",B[B.Breath_Noise=121]="Breath_Noise",B[B.Seashore=122]="Seashore",B[B.Bird_Tweet=123]="Bird_Tweet",B[B.Telephone_Ring=124]="Telephone_Ring",B[B.Helicopter=125]="Helicopter",B[B.Applause=126]="Applause",B[B.Gunshot=127]="Gunshot",B[B.euphonium=128]="euphonium",B[B.AltoClarinetInEb=200]="AltoClarinetInEb",B[B.TrumpetInBb=201]="TrumpetInBb",B[B.BaritoneSaxophone=202]="BaritoneSaxophone",B[B.TenorSaxophone=203]="TenorSaxophone",B[B.ClarinetInEb=204]="ClarinetInEb",B[B.Euphonium=205]="Euphonium",B[B.Alto_Clarinet=206]="Alto_Clarinet",B[B.Bass_Clarinet=207]="Bass_Clarinet",B[B.Bass_Trombone=208]="Bass_Trombone",B[B.clarinet_in_bb=209]="clarinet_in_bb",B[B.clarinet_in_eb=210]="clarinet_in_eb",B[B.Percussion=135]="Percussion",B))(MidiInstrument||{});const _KeyInstruction=class extends AbstractNotationInstruction{constructor(B=void 0,R=0,F=KeyEnum.major){super(B),this.isTransposedBy=0,this.Key=R,this.keyTypeOriginal=R,this.mode=F,this.alteratedNotes=this.calcAlteratedNotes()}static copy(B){const R=new _KeyInstruction(B.parent,B.Key,B.Mode);return R.keyTypeOriginal=B.keyTypeOriginal,R}static getAllPossibleMajorKeyInstructions(){const B=[];for(let R=-7;R<7;R++){const F=new _KeyInstruction(void 0,R,KeyEnum.major);B.push(F)}return B}get Key(){return this.keyType}set Key(B){this.keyType=B,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(B){this.mode=B}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const B=[];if(this.keyType>0)for(let R=0;R=0}getAlterationForPitch(B){return this.keyType>0&&this.alteratedNotes.indexOf(B.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(B.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(B){const R=this;return R===B?!0:!R||!B?!1:R.Key===B.Key&&R.Mode===B.Mode}OperatorNotEqual(B){return!this.OperatorEquals(B)}};let KeyInstruction=_KeyInstruction;KeyInstruction.sharpPositionList=[NoteEnum.F,NoteEnum.C,NoteEnum.G,NoteEnum.D,NoteEnum.A,NoteEnum.E,NoteEnum.B];KeyInstruction.flatPositionList=[NoteEnum.B,NoteEnum.E,NoteEnum.A,NoteEnum.D,NoteEnum.G,NoteEnum.C,NoteEnum.F];var KeyEnum=(B=>(B[B.major=0]="major",B[B.minor=1]="minor",B[B.none=2]="none",B[B.dorian=3]="dorian",B[B.phrygian=4]="phrygian",B[B.lydian=5]="lydian",B[B.mixolydian=6]="mixolydian",B[B.aeolian=7]="aeolian",B[B.ionian=8]="ionian",B[B.locrian=9]="locrian",B))(KeyEnum||{});Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,value:function(){return this[this.length-1]}});Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,value:function(){this.length=0}});Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,value:function(B){return this.indexOf(B)!==-1}});class CollectionUtil{static contains2(R,F){for(let D=0;D{var D,G,U,W;return((G=(D=F.sourceNote.Pitch)==null?void 0:D.getHalfTone())!=null?G:0)-((W=(U=R.sourceNote.Pitch)==null?void 0:U.getHalfTone())!=null?W:0)}),this.notes}sortForVexflow(){return this.notes.sort((R,F)=>{var D,G,U;return((G=(D=R.sourceNote.Pitch)==null?void 0:D.getHalfTone())!=null?G:0)-((U=F.sourceNote.Pitch.getHalfTone())!=null?U:0)}),this.notes}color(){}}class GraphicalMusicSheet{constructor(R,F){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=R,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=F,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get JianpuKeySignature(){return this.jianpuKeySignature}set JianpuKeySignature(R){this.jianpuKeySignature=R}get MusicPages(){return this.musicPages}set MusicPages(R){this.musicPages=R}get MeasureList(){return this.measureList}set MeasureList(R){this.measureList=R}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(R){this.verticalGraphicalStaffEntryContainers=R}get Title(){return this.title}set Title(R){this.title=R}get Subtitle(){return this.subtitle}set Subtitle(R){this.subtitle=R}get Composer(){return this.composer}set Composer(R){this.composer=R}get Lyricist(){return this.lyricist}set Lyricist(R){this.lyricist=R}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(R){this.minAllowedSystemWidth=R}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(R){this.leadSheet=R}static transformRelativeToAbsolutePosition(R){for(let F=0;F=0;D--){const G=this.measureList[D][F];if(G)return G}}findGraphicalStaffEntryFromMeasureList(R,F,D){for(let G=F;G0)return W.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(R,F){const D=[],G=this.measureList[0].length;for(let U=R;U<=F;U++)for(let W=0;W=0;F--){if(this.verticalGraphicalStaffEntryContainers[F].AbsoluteTimestamp.lt(R)){const D=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,R);return this.verticalGraphicalStaffEntryContainers.splice(F+1,0,D),D}if(this.verticalGraphicalStaffEntryContainers[F].AbsoluteTimestamp.Equals(R))return this.verticalGraphicalStaffEntryContainers[F]}}GetVerticalContainerFromTimestamp(R,F=0){const D=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,R),VerticalGraphicalStaffEntryContainer.compareByTimestamp,F);if(D>=0)return this.verticalGraphicalStaffEntryContainers[D]}GetInterpolatedIndexInVerticalContainers(R){const F=this.verticalGraphicalStaffEntryContainers;let D=0,G=F.length-1,U,W;if(R.lte(F[F.length-1].AbsoluteTimestamp)){for(;G-D>1;){const Z=Math.floor((G+D)/2);if(F[D].AbsoluteTimestamp.Equals(R)){G=D;break}else if(F[G].AbsoluteTimestamp.Equals(R)){D=G;break}else{if(F[Z].AbsoluteTimestamp.Equals(R))return this.verticalGraphicalStaffEntryContainers.indexOf(F[Z]);R.lt(F[Z].AbsoluteTimestamp)?G=Z:D=Z}}if(D===G)return this.verticalGraphicalStaffEntryContainers.indexOf(F[D]);U=F[D].AbsoluteTimestamp,W=F[G].AbsoluteTimestamp}else U=F[F.length-1].AbsoluteTimestamp,W=Fraction$1.plus(this.getLongestStaffEntryDuration(F.length-1),U),G=F.length;const q=W.RealValue-U.RealValue,Y=W.RealValue-R.RealValue,K=G-Y/q;return Math.min(K,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(R){const F=[],D=[];for(let G=0,U=R.length;G{var D;return((D=F.parentStaffEntry)==null?void 0:D.relInMeasureTimestamp)!==void 0})}GetNearestNote(R,F){const D=this.GetNearestVoiceEntry(R);if(!D)return;let G,U=Number.MAX_SAFE_INTEGER;for(const W of D.notes){const q=W.PositionAndShape.AbsolutePosition.y,Y=Math.abs(W.PositionAndShape.AbsolutePosition.x-R.x),K=Math.abs(q-R.y);Y+KW.PositionAndShape.RelativePosition.x&&(D=W):D=W)}}catch(G){log$2.info("GraphicalMusicSheet.getStaffEntry",G)}return D}GetPreviousVisibleContainerIndex(R){for(let F=R-1;F>=0;F--){const D=this.verticalGraphicalStaffEntryContainers[F].StaffEntries;for(let G=0,U=D.length;G=0;U--)if(D=this.getStaffEntry(U),D)if(F){if(D.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return D}else return D}findClosestRightStaffEntry(R,F){let D;const G=Math.max(0,Math.ceil(R));for(let U=G;U{};Vex.L=(B,R)=>{if(!R)return;const F=Array.prototype.slice.call(R).join(" ");window.console.log(B+": "+F)};Vex.MakeException=B=>class extends Error{constructor(F,D){super(F),this.name=B,this.message=F,this.data=D}};class RuntimeError{constructor(R,F){this.code=R,this.message=F}toString(){return"[RuntimeError] "+this.code+":"+this.message}}Vex.RuntimeError=RuntimeError;Vex.RERR=Vex.RuntimeError;Vex.Merge=(B,R)=>{for(const F in R)B[F]=R[F];return B};Vex.Min=Math.min;Vex.Max=Math.max;Vex.forEach=(B,R)=>{for(let F=0;FB%R>=R/2?parseInt(B/R,10)*R+R:parseInt(B/R,10)*R;Vex.MidLine=(B,R)=>{let F=R+(B-R)/2;return F%2>0&&(F=Vex.RoundN(F*10,5)/10),F};Vex.SortAndUnique=(B,R,F)=>{if(B.length>1){const D=[];let G;B.sort(R);for(let U=0;U{let F=B.length;for(;F--;)if(B[F]===R)return!0;return!1};Vex.getCanvasContext=B=>{if(!B)throw new Vex.RERR("BadArgument","Invalid canvas selector: "+B);const R=document.getElementById(B);if(!(R&&R.getContext))throw new Vex.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return R.getContext("2d")};Vex.drawDot=(B,R,F,D="#55")=>{B.save(),B.setFillStyle(D),B.beginPath(),B.arc(R,F,3,0,Math.PI*2,!0),B.closePath(),B.fill(),B.restore()};Vex.BM=(B,R)=>{const F=new Date().getTime();R();const D=new Date().getTime()-F;Vex.L(B+D+"ms")};Vex.StackTrace=()=>new Error().stack;Vex.W=(...B)=>{const R=B.join(" ");window.console.log("Warning: ",R,Vex.StackTrace())};Vex.Prefix=B=>Vex.Prefix.prefix+B;Vex.Prefix.prefix="vf-";class Fraction{static GCD(R,F){if(typeof R!="number"||typeof F!="number")throw new Vex.RERR("BadArgument",`Invalid numbers: ${R}, ${F}`);let D;for(;F!==0;)D=F,F=R%F,R=D;return R}static LCM(R,F){return R*F/Fraction.GCD(R,F)}static LCMM(R){if(R.length===0)return 0;if(R.length===1)return R[0];if(R.length===2)return Fraction.LCM(R[0],R[1]);{const F=R[0];return R.shift(),Fraction.LCM(F,Fraction.LCMM(R))}}constructor(R,F){this.set(R,F)}set(R,F){return this.numerator=R===void 0?1:R,this.denominator=F===void 0?1:F,this}value(){return this.numerator/this.denominator}simplify(){let R=this.numerator,F=this.denominator;const D=Fraction.GCD(R,F);return R/=D,F/=D,F<0&&(F=-F,R=-R),this.set(R,F)}add(R,F){let D,G;R instanceof Fraction?(D=R.numerator,G=R.denominator):(R!==void 0?D=R:D=0,F!==void 0?G=F:G=1);const U=Fraction.LCM(this.denominator,G),W=U/this.denominator,q=U/G,Y=this.numerator*W+D*q;return this.set(Y,U)}subtract(R,F){let D,G;R instanceof Fraction?(D=R.numerator,G=R.denominator):(R!==void 0?D=R:D=0,F!==void 0?G=F:G=1);const U=Fraction.LCM(this.denominator,G),W=U/this.denominator,q=U/G,Y=this.numerator*W-D*q;return this.set(Y,U)}multiply(R,F){let D,G;return R instanceof Fraction?(D=R.numerator,G=R.denominator):(R!==void 0?D=R:D=1,F!==void 0?G=F:G=1),this.set(this.numerator*D,this.denominator*G)}divide(R,F){let D,G;return R instanceof Fraction?(D=R.numerator,G=R.denominator):(R!==void 0?D=R:D=1,F!==void 0?G=F:G=1),this.set(this.numerator*G,this.denominator*D)}equals(R){const F=Fraction.__compareA.copy(R).simplify(),D=Fraction.__compareB.copy(this).simplify();return F.numerator===D.numerator&&F.denominator===D.denominator}greaterThan(R){const F=Fraction.__compareB.copy(this);return F.subtract(R),F.numerator>0}greaterThanEquals(R){const F=Fraction.__compareB.copy(this);return F.subtract(R),F.numerator>=0}lessThan(R){return!this.greaterThanEquals(R)}lessThanEquals(R){return!this.greaterThan(R)}clone(){return new Fraction(this.numerator,this.denominator)}copy(R){return typeof R=="number"?this.set(R||0,1):this.set(R.numerator,R.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}fraction(){return this.numerator%this.denominator}abs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return this.numerator+"/"+this.denominator}toSimplifiedString(){return Fraction.__tmp.copy(this).simplify().toString()}toMixedString(){let R="";const F=this.quotient(),D=Fraction.__tmp.copy(this);return F<0?D.abs().fraction():D.fraction(),F!==0?(R+=F,D.numerator!==0&&(R+=" "+D.toSimplifiedString())):D.numerator===0?R="0":R=D.toSimplifiedString(),R}parse(R){const F=R.split("/"),D=parseInt(F[0],10),G=F[1]?parseInt(F[1],10):1;return this.set(D,G)}}Fraction.__compareA=new Fraction;Fraction.__compareB=new Fraction;Fraction.__tmp=new Fraction;const X$3=Vex.MakeException("RegistryError");function setIndexValue(B,R,F,D,G){B[R][F]||(B[R][F]={}),B[R][F][D]=G}class Registry{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(R){Registry.defaultRegistry=R}static getDefaultRegistry(){return Registry.defaultRegistry}static disableDefaultRegistry(){Registry.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:R,name:F,value:D,oldValue:G}){const U=this.getElementById(R);G!==null&&this.index[F][G]&&delete this.index[F][G][R],D!==null&&setIndexValue(this.index,F,D,U.getAttribute("id"),U)}register(R,F){if(F=F||R.getAttribute("id"),!F)throw new X$3("Can't add element without `id` attribute to registry",R);return R.setAttribute("id",F),setIndexValue(this.index,"id",F,F,R),Registry.INDEXES.forEach(D=>{this.updateIndex({id:F,name:D,value:R.getAttribute(D),oldValue:null})}),R.onRegister(this),this}getElementById(R){return this.index.id[R]?this.index.id[R][R]:null}getElementsByAttribute(R,F){const D=this.index[R];return D&&D[F]?Object.keys(D[F]).map(G=>D[F][G]):[]}getElementsByType(R){return this.getElementsByAttribute("type",R)}getElementsByClass(R){return this.getElementsByAttribute("class",R)}onUpdate({id:R,name:F,value:D,oldValue:G}){function U(W,q){return W.filter(Y=>Y===q).length>0}return U(Registry.INDEXES.concat(["id","class"]),F)?(this.updateIndex({id:R,name:F,value:D,oldValue:G}),this):this}}Registry.defaultRegistry=null;class Element$2{static newID(){return"auto"+Element$2.ID++}constructor({type:R}={}){this.attrs={id:Element$2.newID(),el:null,type:R||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,Registry.getDefaultRegistry()&&Registry.getDefaultRegistry().register(this)}setStyle(R){return this.style=R,this}getStyle(){return this.style}applyStyle(R=this.context,F=this.getStyle()){return F?(R.save(),F.shadowColor&&R.setShadowColor(F.shadowColor),F.shadowBlur&&R.setShadowBlur(F.shadowBlur),F.fillStyle&&R.setFillStyle(F.fillStyle),F.strokeStyle&&R.setStrokeStyle(F.strokeStyle),F.lineWidth&&R.setLineWidth(F.lineWidth),this):this}restoreStyle(R=this.context,F=this.getStyle()){return F?(R.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(R){return this.attrs.classes[R]===!0}addClass(R){return this.attrs.classes[R]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:R,oldValue:null}),this}removeClass(R){return delete this.attrs.classes[R],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:R}),this}onRegister(R){return this.registry=R,this}isRendered(){return this.rendered}setRendered(R=!0){return this.rendered=R,this}getAttributes(){return this.attrs}getAttribute(R){return this.attrs[R]}setAttribute(R,F){const D=this.attrs.id,G=this.attrs[R];return this.attrs[R]=F,this.registry&&this.registry.onUpdate({id:D,name:R,value:F,oldValue:G}),this}getContext(){return this.context}setContext(R){return this.context=R,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new Vex.RERR("NoContext","No rendering context attached to instance");return this.context}}Element$2.ID=1e3;class BoundingBoxComputation{constructor(R,F,D,G){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(R,F),this.addPoint(D,G)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(R,F){R!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=R,this.x2=R),Rthis.x2&&(this.x2=R)),F!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=F,this.y2=F),Fthis.y2&&(this.y2=F))}addX(R){this.addPoint(R,null)}addY(R){this.addPoint(null,R)}addQuadraticCurve(R,F,D,G,U,W){const q=R+.6666666666666666*(D-R),Y=F+2/3*(G-F),K=q+1/3*(U-R),Z=Y+1/3*(W-F);this.addBezierCurve(R,F,q,Y,K,Z,U,W)}addBezierCurve(R,F,D,G,U,W,q,Y){const K=[R,F],Z=[D,G],j=[U,W],Q=[q,Y];let J;this.addPoint(K[0],K[1]),this.addPoint(Q[0],Q[1]);const te=(ne,ie)=>Math.pow(1-ne,3)*K[ie]+3*Math.pow(1-ne,2)*ne*Z[ie]+3*(1-ne)*Math.pow(ne,2)*j[ie]+Math.pow(ne,3)*Q[ie];for(J=0;J<=1;J++){const ne=6*K[J]-12*Z[J]+6*j[J],ie=-3*K[J]+9*Z[J]-9*j[J]+3*Q[J],re=3*Z[J]-3*K[J];if(ie===0){if(ne===0)continue;const he=-re/ne;0{if(!B)throw new Vex.RERR("BadArgument","Invalid clef: "+B);const R=Flow.clefProperties.values[B];if(!R)throw new Vex.RERR("BadArgument","Invalid clef: "+B);return R};Flow.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}};Flow.keyProperties=(B,R,F)=>{R===void 0&&(R="treble");const D={octave_shift:0};typeof F=="object"&&Vex.Merge(D,F);const G=B.split("/");if(G.length<2)throw new Vex.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${B}`);const U=G[0].toUpperCase(),W=Flow.keyProperties.note_values[U];if(!W)throw new Vex.RERR("BadArguments","Invalid key name: "+U);W.octave&&(G[1]=W.octave);let q=parseInt(G[1],10);q+=-1*D.octave_shift;let K=(q*7-4*7+W.index)/2;K+=Flow.clefProperties(R).line_shift;let Z=0;K<=0&&K*2%2===0&&(Z=1),K>=6&&K*2%2===0&&(Z=-1);const j=typeof W.int_val!="undefined"?q*12+W.int_val:null,Q=W.code,J=W.shift_right;let te={};if(G.length>2&&G[2]){const ne=G[2].toUpperCase();te=Flow.keyProperties.customNoteHeads[ne]||{}}return{key:U,octave:q,line:K,int_value:j,accidental:W.accidental,code:Q,stroke:Z,shift_right:J,displaced:!1,...te}};Flow.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}};Flow.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}};Flow.integerToNote=B=>{if(typeof B=="undefined")throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(B<-2)throw new Vex.RERR("BadArguments",`integerToNote requires integer > -2: ${B}`);const R=Flow.integerToNote.table[B];if(!R)throw new Vex.RERR("BadArguments",`Unknown note value for integer: ${B}`);return R};Flow.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"};Flow.tabToGlyph=(B,R=1)=>{let F=null,D=0,G=0;if(B.toString().toUpperCase()==="X"){const U=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();F="v7f",D=U.width,G=-U.height/2}else D=Flow.textWidth(B.toString());return{text:B,code:F,getWidth:()=>D*R,shift_y:G}};Flow.textWidth=B=>7*B.toString().length;Flow.articulationCodes=B=>Flow.articulationCodes.articulations[B];Flow.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}};Flow.accidentalCodes=B=>Flow.accidentalCodes.accidentals[B];Flow.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1},ashs:{code:"vd6",parenRightPaddingAdjustment:-1},afhf:{code:"vd7",parenRightPaddingAdjustment:-1}};Flow.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}};Flow.ornamentCodes=B=>Flow.ornamentCodes.ornaments[B];Flow.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"},upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}};Flow.keySignature=B=>{const R=Flow.keySignature.keySpecs[B];if(!R)throw new Vex.RERR("BadKeySignature",`Bad key signature spec: '${B}'`);if(!R.acc)return[];const F=Flow.keySignature.accidentalList(R.acc),D=[];for(let G=0;G({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[B];Flow.parseNoteDurationString=B=>{if(typeof B!="string")return null;const F=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(B);if(!F)return null;const D=F[1],G=F[2].length;let U=F[3];return U.length===0&&(U="n"),{duration:D,dots:G,type:U}};Flow.parseNoteStruct=B=>{const R=B.duration,F=Flow.parseNoteDurationString(R);if(!F)return null;let D=Flow.durationToTicks(F.duration);if(D==null)return null;let G=B.type;const U=[];if(G){if(!Flow.getGlyphProps.validTypes[G])return null}else G=F.type||"n",B.keys!==void 0&&B.keys.forEach((Y,K)=>{const Z=Y.split("/");Z&&Z.length===3&&(U[K]=Z[2])});const W=B.dots?B.dots:F.dots;if(typeof W!="number")return null;let q=D;for(let Y=0;Y{const R=Flow.durationAliases[B];if(R!==void 0&&(B=R),Flow.durationToTicks.durations[B]===void 0)throw new Vex.RERR("BadArguments",`The provided duration is not valid: ${B}`);return B};Flow.durationToFraction=B=>new Fraction().parse(Flow.sanitizeDuration(B));Flow.durationToNumber=B=>Flow.durationToFraction(B).value();Flow.durationToTicks=B=>{B=Flow.sanitizeDuration(B);const R=Flow.durationToTicks.durations[B];return R===void 0?null:R};Flow.durationToTicks.durations={"1/2":Flow.RESOLUTION*2,1:Flow.RESOLUTION/1,2:Flow.RESOLUTION/2,4:Flow.RESOLUTION/4,8:Flow.RESOLUTION/8,16:Flow.RESOLUTION/16,32:Flow.RESOLUTION/32,64:Flow.RESOLUTION/64,128:Flow.RESOLUTION/128,256:Flow.RESOLUTION/256};Flow.durationAliases={w:"1",h:"2",q:"4",b:"256"};Flow.getGlyphProps=(B,R)=>{B=Flow.sanitizeDuration(B);const F=Flow.getGlyphProps.duration_codes[B];if(F===void 0)return null;R||(R="n");let D=F.type[R];if(D===void 0){const G=Flow.keyProperties.customNoteHeads[R.toUpperCase()];if(G===void 0)return null;D={code_head:G.code,...G}}return{...F.common,...D}};Flow.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}};Flow.getGlyphProps.duration_codes={"1/2":{common:{getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v53",B).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},1:{common:{getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v1d",B).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},2:{common:{getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v81",B).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},4:{common:{getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},8:{common:{getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},16:{common:{beam_count:2,getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},32:{common:{beam_count:3,getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},64:{common:{beam_count:4,getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},128:{common:{beam_count:5,getWidth(B=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",B).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}}};Flow.smufl={};Flow.smufl.to_code_points={bracketTop:"v1b",bracketBottom:"v10",barlineTick:"v6f",segno:"v8c",coda:"v4d",gClef:"v83",cClef:"vad",fClef:"v79",unpitchedPercussionClef1:"v59","6stringTabClef":"v2f",timeSig0:"v0",timeSig1:"v1",timeSig2:"v2",timeSig3:"v3",timeSig4:"v4",timeSig5:"v5",timeSig6:"v6",timeSig7:"v7",timeSig8:"v8",timeSig9:"v9",timeSigCommon:"v41",timeSigCutCommon:"vb6",noteheadDoubleWhole:"v53",noteheadWhole:"v1d",noteheadHalf:"v81",noteheadBlack:"vb",noteheadXWhole:"v92",noteheadXHalf:"v95",noteheadXBlack:"v3e",noteheadCircleX:"v3b",noteheadTriangleUpWhole:"v49",noteheadTriangleUpHalf:"v93",noteheadTriangleUpBlack:"v40",noteheadDiamondWhole:"v46",noteheadDiamondHalf:"v2d",noteheadDiamondBlack:"v22",augmentationDot:"v23",tremolo1:"v74",flag8thUp:"v54",flag8thDown:"v9a",flag16thUp:"v3f",flag16thDown:"v8f",flag32ndUp:"v47",flag32ndDown:"v2a",flag64thUp:"va9",flag64thDown:"v58",flag128thUp:"v9b",flag128thDown:"v30",accidentalFlat:"v44",accidentalNatural:"v4e",accidentalSharp:"v18",accidentalDoubleSharp:"v7f",accidentalDoubleFlat:"v26",accidentalParensLeft:"v9c",accidentalParensRight:"v84",accidentalQuarterToneFlatStein:"vab",accidentalThreeQuarterTonesFlatZimmermann:"v9e",accidentalQuarterToneSharpStein:"v78",accidentalThreeQuarterTonesSharpStein:"v51",accidentalBuyukMucennebFlat:"v39",accidentalBakiyeFlat:"vb7",accidentalKomaSharp:"v51",accidentalKucukMucennebSharp:"v8d",accidentalKoron:"vd1",accidentalSori:"vd0",articAccentAbove:"v42",articAccentBelow:"v42",articTenutoAbove:"v25",articTenutoBelow:"v25",articStaccatoAbove:"v23",articStaccatoBelow:"v23",articStaccatissimoAbove:"v28",articMarcatoAbove:"va",fermataAbove:"v43",fermataBelow:"v5b",breathMarkComma:"v6c",breathMarkUpbow:"v8a",caesura:"v34",caesuraCurved:"v4b",restMaxima:"v59",restDoubleWhole:"v31",restWhole:"v5c",restHalf:"vc",restQuarter:"v7c",rest8th:"va5",rest16th:"v3c",rest32nd:"v55",rest64th:"v38",rest128th:"vaa",dynamicPiano:"vbf",dynamicMezzo:"v62",dynamicForte:"vba",dynamicRinforzando:"vba",dynamicSforzando:"v4a",dynamicZ:"v80",ornamentTrill:"v1f",ornamentTurn:"v72",ornamentTurnSlash:"v33",ornamentMordent:"v45",ornamentMordentInverted:"v1e",ornamentTremblement:"v86",ornamentPrecompAppoggTrill:"v20",ornamentPrecompSlideTrillDAnglebert:"v60",ornamentPrecompSlideTrillBach:"v29",ornamentPrecompTrillSuffixDandrieu:"v6d",ornamentPrecompDoubleCadenceUpperPrefix:"vb4",ornamentPrecompDoubleCadenceUpperPrefixTurn:"v68",ornamentPrecompTrillLowerSuffix:"v2c",stringsDownBow:"v94",stringsUpBow:"v75",stringsHarmonic:"vb9",pluckedSnapPizzicatoAbove:"v94",pluckedLeftHandPizzicato:"v8b",keyboardPedalPed:"v36",keyboardPedalUp:"v5d",pictChokeCymbal:"vb3",wiggleArpeggiatoUp:"va3",arrowheadBlackUp:"vc3",arrowheadBlackDown:"v52"};Flow.TIME4_4={num_beats:4,beat_value:4,resolution:Flow.RESOLUTION};class CanvasContext{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(R,F){return Math.max(R,F)>this.CANVAS_BROWSER_SIZE_LIMIT&&(Vex.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),R>this.CANVAS_BROWSER_SIZE_LIMIT&&(R=this.CANVAS_BROWSER_SIZE_LIMIT),F>this.CANVAS_BROWSER_SIZE_LIMIT&&(F=this.CANVAS_BROWSER_SIZE_LIMIT)),[R,F]}constructor(R){this.vexFlowCanvasContext=R,R.canvas?this.canvas=R.canvas:this.canvas={width:CanvasContext.WIDTH,height:CanvasContext.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(R,F,D){return this.vexFlowCanvasContext.font=(D||"")+" "+F+"pt "+R,this}setRawFont(R){return this.vexFlowCanvasContext.font=R,this}setFillStyle(R){return this.vexFlowCanvasContext.fillStyle=R,this}setBackgroundFillStyle(R){return this.background_fillStyle=R,this}setStrokeStyle(R){return this.vexFlowCanvasContext.strokeStyle=R,this}setShadowColor(R){return this.vexFlowCanvasContext.shadowColor=R,this}setShadowBlur(R){return this.vexFlowCanvasContext.shadowBlur=R,this}setLineWidth(R){return this.vexFlowCanvasContext.lineWidth=R,this}setLineCap(R){return this.vexFlowCanvasContext.lineCap=R,this}setLineDash(R){return this.vexFlowCanvasContext.lineDash=R,this}scale(R,F){return this.vexFlowCanvasContext.scale(parseFloat(R),parseFloat(F))}resize(R,F){return[R,F]=this.SanitizeCanvasDims(parseInt(R,10),parseInt(F,10)),this.vexFlowCanvasContext.resize(R,F)}rect(R,F,D,G){return this.vexFlowCanvasContext.rect(R,F,D,G)}fillRect(R,F,D,G){return this.vexFlowCanvasContext.fillRect(R,F,D,G)}clearRect(R,F,D,G){return this.vexFlowCanvasContext.clearRect(R,F,D,G)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(R,F){return this.vexFlowCanvasContext.moveTo(R,F)}lineTo(R,F){return this.vexFlowCanvasContext.lineTo(R,F)}bezierCurveTo(R,F,D,G,U,W){return this.vexFlowCanvasContext.bezierCurveTo(R,F,D,G,U,W)}quadraticCurveTo(R,F,D,G){return this.vexFlowCanvasContext.quadraticCurveTo(R,F,D,G)}arc(R,F,D,G,U,W){return this.vexFlowCanvasContext.arc(R,F,D,G,U,W)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(R){return this.vexFlowCanvasContext.measureText(R)}fillText(R,F,D){return this.vexFlowCanvasContext.fillText(R,F,D)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class RaphaelContext{constructor(R){this.element=R,this.paper=Raphael(R),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}openGroup(){}closeGroup(){}add(){}setFont(R,F,D){return this.state.font_family=R,this.state.font_size=F,this.state.font_weight=D,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(R){return this.attributes.font=R,this}setFillStyle(R){return this.attributes.fill=R,this}setBackgroundFillStyle(R){return this.background_attributes.fill=R,this.background_attributes.stroke=R,this}setStrokeStyle(R){return this.attributes.stroke=R,this}setShadowColor(R){return this.shadow_attributes.color=R,this}setShadowBlur(R){return this.shadow_attributes.width=R,this}setLineWidth(R){this.attributes["stroke-width"]=R,this.lineWidth=R}setLineDash(){return this}setLineCap(){return this}scale(R,F){return this.state.scale={x:R,y:F},this.attributes.transform="S"+R+","+F+",0,0",this.attributes.scale=R+","+F+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+R+","+F+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(R,F){return this.element.style.width=R,this.paper.setSize(R,F),this}setViewBox(R){this.paper.canvas.setAttribute("viewBox",R)}rect(R,F,D,G){return G<0&&(F+=G,G=-G),this.paper.rect(R,F,D-.5,G-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(R,F,D,G){return G<0&&(F+=G,G=-G),this.paper.rect(R,F,D-.5,G-.5).attr(this.attributes),this}clearRect(R,F,D,G){return G<0&&(F+=G,G=-G),this.paper.rect(R,F,D-.5,G-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(R,F){return this.path+="M"+R+","+F,this.pen.x=R,this.pen.y=F,this}lineTo(R,F){return this.path+="L"+R+","+F,this.pen.x=R,this.pen.y=F,this}bezierCurveTo(R,F,D,G,U,W){return this.path+="C"+R+","+F+","+D+","+G+","+U+","+W,this.pen.x=U,this.pen.y=W,this}quadraticCurveTo(R,F,D,G){return this.path+="Q"+R+","+F+","+D+","+G,this.pen.x=D,this.pen.y=G,this}arc(R,F,D,G,U,W){function q(K){for(;K<0;)K+=Math.PI*2;for(;K>Math.PI*2;)K-=Math.PI*2;return K}if(G=q(G),U=q(U),G>U){const K=G;G=U,U=K,W=!W}const Y=U-G;return Y>Math.PI?(this.arcHelper(R,F,D,G,G+Y/2,W),this.arcHelper(R,F,D,G+Y/2,U,W)):this.arcHelper(R,F,D,G,U,W),this}arcHelper(R,F,D,G,U,W){const q=R+D*Math.cos(G),Y=F+D*Math.sin(G),K=R+D*Math.cos(U),Z=F+D*Math.sin(U);let j=0,Q=0;W?(Q=1,U-GMath.PI&&(j=1),this.path+="M"+q+","+Y+",A"+D+","+D+",0,"+j+","+Q+","+K+","+Z+"M"+this.pen.x+","+this.pen.y}glow(){const R=this.paper.set();if(this.shadow_attributes.width>0){const F=this.shadow_attributes,D=F.width/2;for(let G=1;G<=D;G++)R.push(this.paper.path(this.path).attr({stroke:F.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(F.width/D*G).toFixed(3),opacity:+((F.opacity||.3)/D).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return R}fill(){const R=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(R),this}stroke(){const R=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,F=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",R);return this.glow(F),this}closePath(){return this.path+="Z",this}measureText(R){const F=this.paper.text(0,0,R).attr(this.attributes).attr("fill","none").attr("stroke","none"),D=F.getBBox();return F.remove(),{width:D.width,height:D.height}}fillText(R,F,D){return this.paper.text(F+this.measureText(R).width/2,D-this.state.font_size/(2.25*this.state.scale.y),R).attr(this.attributes),this}save(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}restore(){const R=this.state_stack.pop();return this.state.font_family=R.state.font_family,this.attributes.font=R.attributes.font,this.attributes.fill=R.attributes.fill,this.attributes.stroke=R.attributes.stroke,this.attributes["stroke-width"]=R.attributes["stroke-width"],this.shadow_attributes.width=R.shadow_attributes.width,this.shadow_attributes.color=R.shadow_attributes.color,this}}const attrNamesToIgnoreMap={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const B={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,B),Vex.Merge(attrNamesToIgnoreMap.path,B)}class SVGContext{constructor(R){this.element=R,this.svgNS="http://www.w3.org/2000/svg";const F=this.create("svg");this.element.appendChild(F),this.svg=F,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}create(R){return document.createElementNS(this.svgNS,R)}openGroup(R,F,D){const G=this.create("g");return this.groups.push(G),this.parent.appendChild(G),this.parent=G,R&&G.setAttribute("class",Vex.Prefix(R)),F&&G.setAttribute("id",Vex.Prefix(F)),D&&D.pointerBBox&&G.setAttribute("pointer-events","bounding-box"),G}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(R){this.parent.appendChild(R)}iePolyfill(){typeof navigator!="undefined"&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}setFont(R,F,D){let G=!1,U=!1,W="normal";typeof D=="string"&&(D.indexOf("italic")!==-1&&(D=D.replace(/italic/g,""),U=!0),D.indexOf("bold")!==-1&&(D=D.replace(/bold/g,""),G=!0),D=D.replace(/ /g,"")),D=G?"bold":D,D=typeof D=="undefined"||D===""?"normal":D,W=U?"italic":W;const q={"font-family":R,"font-size":F+"pt","font-weight":D,"font-style":W};return this.fontSize=Number(F),Vex.Merge(this.attributes,q),Vex.Merge(this.state,q),this}setRawFont(R){R=R.trim();const F=R.split(" ");return this.attributes["font-family"]=F[1],this.state["font-family"]=F[1],this.attributes["font-size"]=F[0],this.state["font-size"]=F[0],this.fontSize=Number(F[0].match(/\d+/)),this}setFillStyle(R){return this.attributes.fill=R,this}setBackgroundFillStyle(R){return this.background_attributes.fill=R,this.background_attributes.stroke=R,this}setStrokeStyle(R){return this.attributes.stroke=R,this}setShadowColor(R){return this.shadow_attributes.color=R,this}setShadowBlur(R){return this.shadow_attributes.width=R,this}setLineWidth(R){this.attributes["stroke-width"]=R,this.lineWidth=R}setLineDash(R){if(Object.prototype.toString.call(R)==="[object Array]")return R=R.join(", "),this.attributes["stroke-dasharray"]=R,this;throw new Vex.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(R){return this.attributes["stroke-linecap"]=R,this}resize(R,F){this.width=R,this.height=F,this.element.style.width=R;const D={width:R,height:F};return this.applyAttributes(this.svg,D),this.scale(this.state.scale.x,this.state.scale.y),this}scale(R,F){this.state.scale={x:R,y:F};const D=this.width/R,G=this.height/F;return this.setViewBox(0,0,D,G),this}setViewBox(...R){if(R.length===1){const[F]=R;this.svg.setAttribute("viewBox",F)}else{const[F,D,G,U]=R,W=F+" "+D+" "+G+" "+U;this.svg.setAttribute("viewBox",W)}}applyAttributes(R,F){const D=attrNamesToIgnoreMap[R.nodeName];return Object.keys(F).forEach(G=>{var U;D&&D[G]||!G||!F[G]||G==="d"&&((U=F[G])==null?void 0:U.indexOf("NaN"))>-1||R.setAttributeNS(null,G,F[G])}),R}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(R,F,D,G,U){G<0&&(F+=G,G*=-1);const W=this.create("rect");return typeof U=="undefined"&&(U={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),Vex.Merge(U,{x:R,y:F,width:D,height:G}),this.applyAttributes(W,U),this.add(W),this}fillRect(R,F,D,G){return G<0&&(F+=G,G*=-1),this.rect(R,F,D,G,this.attributes),this}clearRect(R,F,D,G){return this.rect(R,F,D,G,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(R,F){return this.path+="M"+R+" "+F,this.pen.x=R,this.pen.y=F,this}lineTo(R,F){return this.path+="L"+R+" "+F,this.pen.x=R,this.pen.y=F,this}bezierCurveTo(R,F,D,G,U,W){return this.path+="C"+R+" "+F+","+D+" "+G+","+U+" "+W,this.pen.x=U,this.pen.y=W,this}quadraticCurveTo(R,F,D,G){return this.path+="Q"+R+" "+F+","+D+" "+G,this.pen.x=D,this.pen.y=G,this}arc(R,F,D,G,U,W){function q(K){for(;K<0;)K+=Math.PI*2;for(;K>Math.PI*2;)K-=Math.PI*2;return K}if(G=q(G),U=q(U),G>U){const K=G;G=U,U=K,W=!W}const Y=U-G;return Y>Math.PI?(this.arcHelper(R,F,D,G,G+Y/2,W),this.arcHelper(R,F,D,G+Y/2,U,W)):this.arcHelper(R,F,D,G,U,W),this}arcHelper(R,F,D,G,U,W){const q=R+D*Math.cos(G),Y=F+D*Math.sin(G),K=R+D*Math.cos(U),Z=F+D*Math.sin(U);let j=0,Q=0;W?(Q=1,U-GMath.PI&&(j=1),this.path+="M"+q+" "+Y+" A"+D+" "+D+" 0 "+j+" "+Q+" "+K+" "+Z,!isNaN(this.pen.x)&&!isNaN(this.pen.y)&&(this.peth+="M"+this.pen.x+" "+this.pen.y)}closePath(){return this.path+="Z",this}glow(){if(this.shadow_attributes.width>0){const R=this.shadow_attributes,F=R.width/2;for(let D=1;D<=F;D++){const G={stroke:R.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(R.width*.4/F*D).toFixed(3),opacity:+((R.opacity||.3)/F).toFixed(3)},U=this.create("path");G.d=this.path,this.applyAttributes(U,G),this.add(U)}}return this}fill(R){this.glow();const F=this.create("path");let D=R;return typeof R=="undefined"?(R={},Vex.Merge(R,this.attributes),R.stroke="none",D=R):(D=R,Vex.Merge(D,this.attributes),R.class&&(D.class=R.class),R.id&&(D.id=R.id)),R.d=this.path,this.applyAttributes(F,R),this.add(F),this}stroke(R=void 0){this.glow();const F=this.create("path"),D={};return Vex.Merge(D,this.attributes),R&&Vex.Merge(D,R),D.fill="none",D["stroke-width"]=this.lineWidth,D.d=this.path,this.applyAttributes(F,D),this.add(F),this}measureText(R){const F=this.create("text");if(typeof F.getBBox!="function")return{x:0,y:0,width:0,height:0};F.textContent=R,this.applyAttributes(F,this.attributes),this.svg.appendChild(F);let D=F.getBBox();return this.ie&&R!==""&&this.attributes["font-style"]==="italic"&&(D=this.ieMeasureTextFix(D,R)),this.svg.removeChild(F),D}ieMeasureTextFix(R){const F=Number(this.fontSize),D=1.196,G=1.9598,U=D*F+G,W=R.width-U,q=R.height-1.5;return{x:R.x,y:R.y,width:W,height:q}}fillText(R,F,D){if(!R||R.length<=0)return;const G={};Vex.Merge(G,this.attributes),G.stroke="none",G.x=F,G.y=D;const U=this.create("text");U.textContent=R,this.applyAttributes(U,G),this.add(U)}save(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}restore(){const R=this.state_stack.pop();return this.state["font-family"]=R.state["font-family"],this.state["font-weight"]=R.state["font-weight"],this.state["font-style"]=R.state["font-style"],this.state["font-size"]=R.state["font-size"],this.state.scale=R.state.scale,this.attributes["font-family"]=R.attributes["font-family"],this.attributes["font-weight"]=R.attributes["font-weight"],this.attributes["font-style"]=R.attributes["font-style"],this.attributes["font-size"]=R.attributes["font-size"],this.attributes.fill=R.attributes.fill,this.attributes.stroke=R.attributes.stroke,this.attributes["stroke-width"]=R.attributes["stroke-width"],this.attributes["stroke-dasharray"]=R.attributes["stroke-dasharray"],this.shadow_attributes.width=R.shadow_attributes.width,this.shadow_attributes.color=R.shadow_attributes.color,this.lineWidth=R.lineWidth,this}}let lastContext=null;class Renderer{static get Backends(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}static get LineEndType(){return{NONE:1,UP:2,DOWN:3}}static get USE_CANVAS_PROXY(){return!1}static get lastContext(){return lastContext}static set lastContext(R){lastContext=R}static buildContext(R,F,D,G,U){const W=new Renderer(R,F);D&&G&&W.resize(D,G),U||(U="#FFF");const q=W.getContext();return q.setBackgroundFillStyle(U),Renderer.lastContext=q,q}static getCanvasContext(R,F,D,G){return Renderer.buildContext(R,Renderer.Backends.CANVAS,F,D,G)}static getRaphaelContext(R,F,D,G){return Renderer.buildContext(R,Renderer.Backends.RAPHAEL,F,D,G)}static getSVGContext(R,F,D,G){return Renderer.buildContext(R,Renderer.Backends.SVG,F,D,G)}static bolsterCanvasContext(R){if(Renderer.USE_CANVAS_PROXY)return new CanvasContext(R);const F=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return R.vexFlowCanvasContext=R,F.forEach(D=>{R[D]=R[D]||CanvasContext.prototype[D]}),R}static drawDashedLine(R,F,D,G,U,W){R.beginPath();const q=G-F,Y=U-D,K=Math.atan2(Y,q);let Z=F,j=D;R.moveTo(F,D);let Q=0,J=!0;for(;!((q<0?Z<=G:Z>=G)&&(Y<0?j<=U:j>=U));){const te=W[Q++%W.length],ne=Z+Math.cos(K)*te;Z=q<0?Math.max(G,ne):Math.min(G,ne);const ie=j+Math.sin(K)*te;j=Y<0?Math.max(U,ie):Math.min(U,ie),J?R.lineTo(Z,j):R.moveTo(Z,j),J=!J}R.closePath(),R.stroke()}constructor(R,F){if(this.elementId=R,!this.elementId)throw new Vex.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(R),this.element||(this.element=R),this.ctx=null,this.paper=null,this.backend=F,this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${R}`);this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===Renderer.Backends.RAPHAEL)this.ctx=new RaphaelContext(this.element);else if(this.backend===Renderer.Backends.SVG)this.ctx=new SVGContext(this.element);else throw new Vex.RERR("InvalidBackend",`No support for backend: ${this.backend}`)}resize(R,F){if(this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[R,F]=CanvasContext.SanitizeCanvasDims(R,F);const D=window.devicePixelRatio||1;this.element.width=R*D,this.element.height=F*D,this.element.style.width=R+"px",this.element.style.height=F+"px",this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(D,D)}else this.ctx.resize(R,F);return this}getContext(){return this.ctx}}function L$k(...B){Stem.DEBUG&&Vex.L("Vex.Flow.Stem",B)}class Stem extends Element$2{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return Flow.STEM_WIDTH}static get HEIGHT(){return Flow.STEM_HEIGHT}constructor(R={}){super(),this.setAttribute("type","Stem"),this.x_begin=R.x_begin||0,this.x_end=R.x_end||0,this.y_top=R.y_top||0,this.y_bottom=R.y_bottom||0,this.stem_extension=R.stem_extension||0,this.stem_direction=R.stem_direction||0,this.hide=R.hide||!1,this.isStemlet=R.isStemlet||!1,this.stemletHeight=R.stemletHeight||0,this.resetHeight=0,this.renderHeightAdjustment=0,this.setOptions(R)}setResetHeight(R){this.resetHeight=R}setOptions(R){this.stem_up_y_offset=R.stem_up_y_offset||0,this.stem_down_y_offset=R.stem_down_y_offset||0}setNoteHeadXBounds(R,F){return this.x_begin=R,this.x_end=F,this}setDirection(R){this.stem_direction=R}setExtension(R){this.stem_extension=R}getExtension(){return this.stem_extension}setYBounds(R,F){this.y_top=R,this.y_bottom=F}getCategory(){return Stem.CATEGORY}getHeight(){const R=this.stem_direction===Stem.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(Stem.HEIGHT-R+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new Vex.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const R=this.stem_direction===Stem.UP,F=[this.y_top,this.y_bottom],D=Stem.HEIGHT+this.stem_extension,G=(R?Math.min:Math.max)(...F),U=(R?Math.max:Math.min)(...F);return{topY:G+D*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:U}}setVisibility(R){return this.hide=!R,this}setStemlet(R,F){return this.isStemlet=R,this.stemletHeight=F,this}draw(){if(this.setRendered(),this.hide)return;const R=this.checkContext();let F,D;const G=this.stem_direction;G===Stem.DOWN?(F=this.x_begin,D=this.y_top+this.stem_down_y_offset):(F=this.x_end,D=this.y_bottom-this.stem_up_y_offset);const U=this.getHeight();L$k("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const W=this.isStemlet?U-this.stemletHeight*this.stem_direction:0;if(R.save(),this.applyStyle(R),R.beginPath(),R.setLineWidth(Stem.WIDTH),R.moveTo(F,D-W),R.lineTo(F,D-U-this.renderHeightAdjustment*G-this.resetHeight*G),R.svg){const q={class:Vex.Prefix("stem")};this.id&&(q.id=this.id),R.stroke(q)}else R.stroke();this.restoreStyle(R),R.restore()}}class Tuplet$1 extends Element$2{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(R,F){if(super(),this.setAttribute("type","Tuplet"),!R||!R.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=Vex.Merge({},F),this.notes=R,this.num_notes="num_notes"in this.options?this.options.num_notes:R.length,this.options.beats_occupied&&this.beatsOccupiedDeprecationWarning(),this.notes_occupied=this.options.notes_occupied||this.options.beats_occupied||2,"bracketed"in this.options?this.bracketed=this.options.bracketed:this.bracketed=R.some(D=>D.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||Tuplet$1.LOCATION_TOP,Formatter.AlignRestsToNotes(R,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let R=0;R=1;)this.numerator_glyphs.unshift(new Glyph("v"+R%10,this.point)),R=parseInt(R/10,10);for(this.denom_glyphs=[],R=this.notes_occupied;R>=1;)this.denom_glyphs.unshift(new Glyph("v"+R%10,this.point)),R=parseInt(R/10,10)}getNestedTupletCount(){const R=this.location,F=this.notes[0];let D=U(F,R),G=U(F,R);function U(W,q){return W.tupletStack.filter(Y=>Y.location===q).length}return this.notes.forEach(W=>{const q=U(W,R);D=q>D?q:D,G=qG&&(G=W)}}return G+R+F}draw(){this.checkContext(),this.setRendered();const R=this.notes[0],F=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=R.getTieLeftX()-5,this.width=F.getTieRightX()-this.x_pos+5):(this.x_pos=R.getStemX(),this.width=F.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const D=(Y,K)=>Y+K.getMetrics().width;let G=this.numerator_glyphs.reduce(D,0);this.ratioed&&(G=this.denom_glyphs.reduce(D,G),G+=this.point*.32);const W=this.x_pos+this.width/2-G/2;if(this.bracketed){const Y=this.width/2-G/2-5;Y>0&&(this.context.fillRect(this.x_pos,this.y_pos,Y,1),this.context.fillRect(this.x_pos+this.width/2+G/2+5,this.y_pos,Y,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===Tuplet$1.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===Tuplet$1.LOCATION_BOTTOM),1,this.location*10))}let q=0;if(this.numerator_glyphs.forEach(Y=>{Y.render(this.context,W+q,this.y_pos+this.point/3-2),q+=Y.getMetrics().width}),this.ratioed){const Y=W+q+this.point*.16,K=this.point*.06;this.context.beginPath(),this.context.arc(Y,this.y_pos-this.point*.08,K,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(Y,this.y_pos+this.point*.12,K,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),q+=this.point*.32,this.denom_glyphs.forEach(Z=>{Z.render(this.context,W+q,this.y_pos+this.point/3-2),q+=Z.getMetrics().width})}}}function calculateStemDirection(B){let R=0;return B.forEach(F=>{F.keyProps&&F.keyProps.forEach(D=>{R+=D.line-3})}),R>=0?Stem.DOWN:Stem.UP}const getStemSlope=(B,R)=>{const F=B.getStemExtents().topY,D=B.getStemX(),G=R.getStemExtents().topY,U=R.getStemX();return(G-F)/(U-D)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B";class Beam$1 extends Element$2{static getDefaultBeamGroups(R){(!R||R==="c")&&(R="4/4");const D={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[R];if(D===void 0){const G=parseInt(R.split("/")[0],10),U=parseInt(R.split("/")[1],10);if(G%3===0)return[new Fraction(3,U)];if(U>4)return[new Fraction(2,U)];if(U<=4)return[new Fraction(1,U)]}else return D.map(G=>new Fraction().parse(G));return[new Fraction(1,4)]}static applyAndGetBeams(R,F,D){return Beam$1.generateBeams(R.getTickables(),{groups:D,stem_direction:F})}static generateBeams(R,F){F||(F={}),(!F.groups||!F.groups.length)&&(F.groups=[new Fraction(2,8)]);const D=F.groups.map(fe=>{if(!fe.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return fe.clone().multiply(Flow.RESOLUTION,1)}),G=R;let U=0,W=[],q=[];function Y(fe){return fe.reduce((he,ge)=>ge.getTicks().clone().add(he),new Fraction(0,1))}function K(){D.length-1>U?U+=1:U=0}function Z(){let fe=[];G.forEach(he=>{if(fe=[],he.shouldIgnoreTicks()){W.push(q),q=fe;return}q.push(he);const ge=D[U].clone(),ce=Y(q),me=Flow.durationToNumber(he.duration)<8;me&&he.tuplet&&(ge.numerator*=2),ce.greaterThan(ge)?(me||fe.push(q.pop()),W.push(q),q=fe,K()):ce.equals(ge)&&(W.push(q),q=fe,K())}),q.length>0&&W.push(q)}function j(){return W.filter(fe=>{if(fe.length>1){let he=!0;return fe.forEach(ge=>{ge.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(he=!1)}),he}return!1})}function Q(){const fe=[];W.forEach(he=>{let ge=[];he.forEach((ce,me,ye)=>{const ve=me===0||me===ye.length-1,pe=ye[me-1],be=!F.beam_rests&&ce.isRest(),xe=F.beam_rests&&F.beam_middle_only&&ce.isRest()&&ve;let ue=!1;if(F.maintain_stem_directions&&pe&&!ce.isRest()&&!pe.isRest()){const Ae=pe.getStemDirection();ue=ce.getStemDirection()!==Ae}const _e=parseInt(ce.duration,10)<8;be||xe||ue||_e?(ge.length>0&&fe.push(ge),ge=ue?[ce]:[]):ge.push(ce)}),ge.length>0&&fe.push(ge)}),W=fe}function J(){W.forEach(fe=>{let he;if(F.maintain_stem_directions){const ge=te(fe);he=ge?ge.getStemDirection():Stem.UP}else F.stem_direction?he=F.stem_direction:he=calculateStemDirection(fe);ne(fe,he)})}function te(fe){for(let he=0;he{ge.setStemDirection(he)})}function ie(){const fe=[];return W.forEach(he=>{let ge=null;he.forEach(ce=>{ce.tuplet&&ge!==ce.tuplet&&(ge=ce.tuplet,fe.push(ge))})}),fe}Z(),Q(),J();const re=j(),oe=ie(),le=[];return re.forEach(fe=>{const he=new Beam$1(fe);F.show_stemlets&&(he.render_options.show_stemlets=!0),F.secondary_breaks&&(he.render_options.secondary_break_ticks=Flow.durationToTicks(F.secondary_breaks)),F.flat_beams===!0&&(he.render_options.flat_beams=!0,he.render_options.flat_beam_offset=F.flat_beam_offset),le.push(he)}),oe.forEach(fe=>{const he=fe.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;fe.setTupletLocation(he);let ge=!1;for(let ce=0;ce=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let D,G;for(this.stem_direction=Stem.UP,D=0;Dq+Y.stem_direction,0)>-1?Stem.UP:Stem.DOWN),D=0;DD.getGlyph().beam_count).reduce((D,G)=>G>D?G:D)}breakSecondaryAt(R){return this.break_on_indices=R,this}getSlopeY(R,F,D,G){return D+(R-F)*G}calculateSlope(){const{notes:R,stem_direction:F,render_options:{max_slope:D,min_slope:G,slope_iterations:U,slope_cost:W}}=this,q=R[0],Y=getStemSlope(q,R[R.length-1]),K=(D-G)/U;let Z=Number.MAX_VALUE,j=0,Q=0;for(let J=G;J<=D;J+=K){let te=0,ne=0;for(let le=1;leie)&&(K=ie,q=Math.min(...ne.getYs()),Y=ne.getBeamCount())}let Z=W/R.length;const j=D*1.5,Q=G+Y*j,J=q+Q*-F;F===Stem.DOWN&&ZJ&&(Z=q-Q),U+this.render_options.flat_beam_offset_per_beam>0?F===Stem.DOWN&&Z>U&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=Z:F===Stem.UP&&Z0){let G=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(G+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let U=this.notes[0].note_heads[0].y;const W=this.stem_direction>0?Math.min:Math.max;for(const q of this.notes)for(const Y of q.note_heads)U=W(U,Y.y);D=U+G*-this.stem_direction}return D}applyStemExtensions(){const{notes:R,slope:F,y_shift:D,stem_direction:G,beam_count:U,render_options:{show_stemlets:W,stemlet_extension:q,beam_width:Y}}=this,K=R[0],Z=this.getBeamYToDraw(),j=K.getStemX();for(let Q=0;Q=8&&(J=this.break_on_indices.indexOf(Z)!==-1,this.render_options.secondary_break_ticks&&Y>=this.render_options.secondary_break_ticks&&(Y=0,J=!0));const te=j.getIntrinsicTicks(){R.getStem()&&(this.context.openGroup("stem",R.getAttribute("id")+"-stem"),R.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const R=["4","8","16","32","64"],F=this.notes[0];let D=this.getBeamYToDraw();const G=F.getStemX(),U=this.render_options.beam_width*this.stem_direction,W={};for(const q of this.notes)W[q.getAttribute("id")]=0;for(let q=0;q{R.getStave()||R.setStave(this.stave)}),this.preFormatted=!0,this)}draw(R=this.context,F=this.stave){this.setRendered();let D=null;for(let G=0;G0&&D){const W=U.getBoundingBox();W&&D.mergeWith(W)}U.setContext(R),U.drawWithStyle()}this.boundingBox=D}}function drawBoldDoubleLine(B,R,F,D,G){if(R!==StaveConnector.type.BOLD_DOUBLE_LEFT&&R!==StaveConnector.type.BOLD_DOUBLE_RIGHT)throw new Vex.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let U=3,W=3.5;const q=2;R===StaveConnector.type.BOLD_DOUBLE_RIGHT&&(U=-5,W=3),B.fillRect(F+U,D,1,G-D),B.fillRect(F-q,D,W,G-D)}class StaveConnector extends Element$2{static get type(){return{SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8}}static get typeString(){return{singleRight:StaveConnector.type.SINGLE_RIGHT,singleLeft:StaveConnector.type.SINGLE_LEFT,single:StaveConnector.type.SINGLE,double:StaveConnector.type.DOUBLE,brace:StaveConnector.type.BRACE,bracket:StaveConnector.type.BRACKET,boldDoubleLeft:StaveConnector.type.BOLD_DOUBLE_LEFT,boldDoubleRight:StaveConnector.type.BOLD_DOUBLE_RIGHT,thinDouble:StaveConnector.type.THIN_DOUBLE,none:StaveConnector.type.NONE}}constructor(R,F){super(),this.setAttribute("type","StaveConnector"),this.thickness=Flow.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=R,this.bottom_stave=F,this.type=StaveConnector.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(R){return R=typeof R=="string"?StaveConnector.typeString[R]:R,R>=StaveConnector.type.SINGLE_RIGHT&&R<=StaveConnector.type.NONE&&(this.type=R),this}setText(R,F){return this.texts.push({content:R,options:Vex.Merge({shift_x:0,shift_y:0},F)}),this}setFont(R){Vex.Merge(this.font,R)}setXShift(R){if(typeof R!="number")throw Vex.RERR("InvalidType","x_shift must be a Number");return this.x_shift=R,this}draw(){const R=this.checkContext();this.setRendered();let F=this.top_stave.getYForLine(0),D=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,G=this.width,U=this.top_stave.getX();(this.type===StaveConnector.type.SINGLE_RIGHT||this.type===StaveConnector.type.BOLD_DOUBLE_RIGHT||this.type===StaveConnector.type.THIN_DOUBLE)&&(U=this.top_stave.getX()+this.top_stave.width);let q=D-F;switch(this.type){case StaveConnector.type.SINGLE:G=1;break;case StaveConnector.type.SINGLE_LEFT:G=1;break;case StaveConnector.type.SINGLE_RIGHT:G=1;break;case StaveConnector.type.DOUBLE:U-=this.width+2;break;case StaveConnector.type.BRACE:{G=12;const Y=this.top_stave.getX()-2+this.x_shift,K=F,Z=Y,j=D,Q=Y-G,J=K+q/2,te=Q-.9*G,ne=K+.2*q,ie=Y+1.1*G,re=J-.135*q,oe=ie,le=J+.135*q,fe=te,he=j-.2*q,ge=Q-G,ce=he,me=Y+.4*G,ye=J+.135*q,ve=me,pe=J-.135*q,be=ge,xe=ne;R.beginPath(),R.moveTo(Y,K),R.bezierCurveTo(te,ne,ie,re,Q,J),R.bezierCurveTo(oe,le,fe,he,Z,j),R.bezierCurveTo(ge,ce,me,ye,Q,J),R.bezierCurveTo(ve,pe,be,xe,Y,K),R.fill(),R.stroke();break}case StaveConnector.type.BRACKET:F-=4,D+=4,q=D-F,Glyph.renderGlyph(R,U-5,F-3,40,"v1b",!0),Glyph.renderGlyph(R,U-5,D+3,40,"v10",!0),U-=this.width+2;break;case StaveConnector.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(R,this.type,U+this.x_shift,F,D);break;case StaveConnector.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(R,this.type,U,F,D);break;case StaveConnector.type.THIN_DOUBLE:G=1;break;case StaveConnector.type.NONE:break;default:throw new Vex.RERR("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid`)}this.type!==StaveConnector.type.BRACE&&this.type!==StaveConnector.type.BOLD_DOUBLE_LEFT&&this.type!==StaveConnector.type.BOLD_DOUBLE_RIGHT&&this.type!==StaveConnector.type.NONE&&R.fillRect(U,F,G,q),this.type===StaveConnector.type.THIN_DOUBLE&&R.fillRect(U-3,F,G,q),R.save(),R.lineWidth=2,R.setFont(this.font.family,this.font.size,this.font.weight);for(let Y=0;Y0){const ie=ne.space.deviation,re=ie>=0?"+":"";R.setFillStyle("red"),R.fillText(re+Math.round(ie),q+F.getXShift(),D-10)}R.restore()}constructor(R){if(super(),this.setAttribute("type","Note"),!R)throw new Vex.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const F=Flow.parseNoteStruct(R);if(!F)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(R)}`);if(this.duration=F.duration,this.dots=F.dots,this.noteType=F.type,this.customTypes=F.customTypes,this.DYMusicScoreType=R.DYMusicScoreType,R.duration_override?this.setDuration(R.duration_override):this.setIntrinsicTicks(F.ticks),this.modifiers=[],this.glyph=Flow.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(D=>Flow.getGlyphProps(this.duration,D)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new Vex.RuntimeError("BadArguments","Note keys must be array type.");this.playNote=null,this.tickContext=null,this.modifierContext=null,this.ignore_ticks=!1,this.width=0,this.extraLeftPx=0,this.extraRightPx=0,this.x_shift=0,this.left_modPx=0,this.right_modPx=0,this.voice=null,this.preFormatted=!1,this.ys=[],R.align_center&&this.setCenterAlignment(R.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:Note.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(R){return this.playNote=R,this}isRest(){return!1}addStroke(R,F){return F.setNote(this),F.setIndex(R),this.modifiers.push(F),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(R){return this.stave=R,this.setYs([R.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return Note.CATEGORY}setContext(R){return this.context=R,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(R){return this.extraLeftPx=R,this}setExtraRightPx(R){return this.extraRightPx=R,this}shouldIgnoreTicks(){return this.ignore_ticks}getLineNumber(){return 0}getLineForRest(){return 0}getGlyph(){return this.glyph}getGlyphWidth(){return this.glyph.getWidth?this.glyph.getWidth(this.render_options.glyph_font_scale):15}setYs(R){return this.ys=R,this}getYs(){if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(R){if(!this.stave)throw new Vex.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(R)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new Vex.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(R){return this.voice=R,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(R){return this.tickContext=R,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.dots>0}hasStem(){return!1}getDots(){return this.dots}getNoteType(){return this.noteType}setBeam(){return this}setModifierContext(R){return this.modifierContext=R,this}addModifier(R,F=0){return R.setNote(this),R.setIndex(F),this.modifiers.push(R),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let R=0,F=0;this.modifierContext!=null&&(R=this.modifierContext.state.left_shift,F=this.modifierContext.state.right_shift);const D=this.getWidth();return{width:D,noteWidth:D-R-F-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:R,modRightPx:F,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(R){this.width=R}getWidth(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}setXShift(R){return this.x_shift=R,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let R=this.tickContext.getX();return this.stave&&(R+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(this.DYMusicScoreType==="jianpu"||(R+=this.getCenterXShift())),R}setPreFormatted(R){if(this.preFormatted=R,this.preFormatted){const F=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,F.left),this.right_modPx=Math.max(this.right_modPx,F.right)}}}function L$j(...B){NoteHead.DEBUG&&Vex.L("Vex.Flow.NoteHead",B)}function drawSlashNoteHead(B,R,F,D,G,U){const W=Flow.SLASH_NOTEHEAD_WIDTH;B.save(),B.setLineWidth(Flow.STEM_WIDTH);let q=!1;if(Flow.durationToNumber(R)>2&&(q=!0),q||(F-=Flow.STEM_WIDTH/2*G),B.beginPath(),B.moveTo(F,D+U),B.lineTo(F,D+1),B.lineTo(F+W,D-U),B.lineTo(F+W,D),B.lineTo(F,D+U),B.closePath(),q?B.fill():B.stroke(),Flow.durationToFraction(R).equals(.5)){const Y=[-3,-1,W+1,W+3];for(let K=0;K{const q=W.getTickContext();W.setStave(F.stave),q.setXOffset(U)})}}class Dot extends Modifier{static get CATEGORY(){return"dots"}static format(R,F){const D=F.right_shift,G=1;if(!R||R.length===0)return!1;const U=[],W={};for(let J=0;Jte.line-J.line);let q=D,Y=0,K=null,Z=null,j=null,Q=0;for(let J=0;JY?q:Y,K=re,Z=ne}return F.right_shift+=Y,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=Modifier.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return Dot.CATEGORY}setNote(R){this.note=R,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(R){return this.dot_shiftY=R,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new Vex.RERR("NoAttachedNote","Can't draw dot without a note and index.");const R=this.note.stave.options.spacing_between_lines_px,F=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(F.y=this.note.getStemExtents().baseY+1);const D=F.x+this.x_shift+this.width-this.radius,G=F.y+this.y_shift+this.dot_shiftY*R,U=this.context;U.beginPath(),U.arc(D,G,this.radius,0,Math.PI*2,!1),U.fill()}}function L$i(...B){StaveNote.DEBUG&&Vex.L("Vex.Flow.StaveNote",B)}const getStemAdjustment=B=>Stem.WIDTH/(2*-B.getStemDirection()),isInnerNoteIndex=(B,R)=>R===(B.getStemDirection()===Stem.UP?B.keyProps.length-1:0);function shiftRestVertical(B,R,F){const D=(R.isrest?0:1)*F;B.line+=D,B.maxLine+=D,B.minLine+=D,B.note.setKeyLine(0,B.note.getKeyLine(0)+D)}function centerRest(B,R,F){const D=B.line-Vex.MidLine(R.minLine,F.maxLine);B.note.setKeyLine(0,B.note.getKeyLine(0)-D),B.line-=D,B.maxLine-=D,B.minLine-=D}class StaveNote extends StemmableNote{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return Stem.UP}static get STEM_DOWN(){return Stem.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static renderVibrato(R,F,D,G,U){const{vibrato_width:W,wave_width:q,wave_girth:Y,wave_height:K}=G,Z=W/q,j=Math.abs(U-D)/Z+2;R.beginPath();let Q;for(R.moveTo(F,D+Y),Q=0;Q2?D[1]:null;let Y=U>2?D[2]:D[1];U===2&&W.stemDirection===-1&&Y.stemDirection===1&&(W=D[1],Y=D[0]);const K=Math.max(W.voice_shift,Y.voice_shift);let Z=0,j;if(U===2){const Q=W.stemDirection===Y.stemDirection?0:.5;if(W.stemDirection===Y.stemDirection&&W.minLine<=Y.maxLine&&(W.isrest||(j=Math.abs(W.line-(Y.maxLine+.5)),j=Math.max(j,W.stemMin),W.minLine=W.line-j,W.note.setStemLength(j*10))),W.minLine<=Y.maxLine+Q)if(W.isrest)shiftRestVertical(W,Y,1);else if(Y.isrest)shiftRestVertical(Y,W,-1);else{Z=K;const J=Math.abs(W.line-Y.line);let te=0,ne=0;W.note.duration==="h"?te++:W.note.duration==="w"&&ne++,Y.note.duration==="h"?te++:Y.note.duration==="w"&&ne++;let ie=te===1||ne===1||W.note.dots!==Y.note.dots;if(G&&(ie=ie||ne===2),J===0&&ie){if(Y.note.setXShift(Z),W.note.dots>0){let re=0;for(const oe of W.note.modifiers)if(oe instanceof Dot&&(re++,oe.setYShift(-10*(Y.maxLine-W.line+1)),re===W.note.dots))break}}else J<1&&J>0?Y.note.setXShift(Z):W.note.voice!==Y.note.voice&&W.stemDirection===Y.stemDirection&&(W.line>Y.line?W.stemDirection===1?Y.note.renderFlag=!1:W.note.renderFlag=!1:Y.line>W.line?Y.stemDirection===1?W.note.renderFlag=!1:Y.note.renderFlag=!1:Y.stemDirection===1&&(Y.stemDirection=-1,Y.note.setStemDirection(-1)))}return!0}if(q!==null&&q.minLineF.postFormat()),!0):!1}constructor(R){if(super(R),this.setAttribute("type","StaveNote"),this.keys=R.keys,this.clef=R.clef,this.octave_shift=R.octave_shift,this.beam=null,this.vibrato=null,this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(R)}`);this.displaced=!1,this.dot_shiftY=0,this.addDotsCount=0,this.keyProps=[],this.use_default_head_x=!1,this.note_heads=[],this.modifiers=[],Vex.Merge(this.render_options,{glyph_font_scale:R.glyph_font_scale||Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:R.stroke_px||StaveNote.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),R.auto_stem?this.autoStem():this.setStemDirection(R.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const R=this.note_heads.map(F=>F.getStyle());this.buildNoteHeads(),this.note_heads.forEach((F,D)=>F.setStyle(R[D])),this.stave&&this.note_heads.forEach(F=>F.setStave(this.stave)),this.calcExtraPx()}setBeam(R){return this.beam=R,this.calcExtraPx(),this}setVibrato(R){this.vibrato=R}getCategory(){return StaveNote.CATEGORY}buildStem(){this.setStem(new Stem({hide:!!this.isRest()})),this.stem.id=Vex.Prefix(`${this.getAttribute("id")}-stem`)}buildNoteHeads(){this.note_heads=[];const R=this.getStemDirection(),F=this.getKeys();let D=null,G=null,U=!1,W,q,Y;R===Stem.UP?(W=0,q=F.length,Y=1):R===Stem.DOWN&&(W=F.length-1,q=-1,Y=-1);for(let K=W;K!==q;K+=Y){const Z=this.keyProps[K],j=Z.line;D===null?D=j:(G=Math.abs(D-j),G===0||G===.5?U=!U:(U=!1,this.use_default_head_x=!0)),D=j;const Q=new NoteHead({duration:this.duration,note_type:this.noteType,displaced:U,stem_direction:R,custom_glyph_code:Z.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:Z.shift_right,stem_up_x_offset:Z.stem_up_x_offset,stem_down_x_offset:Z.stem_down_x_offset,line:Z.line});this.note_heads[K]=Q}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const R=3,D=(this.minLine+this.maxLine)/20&&(this.keyProps[F-1].displaced=!0)),R=W,this.keyProps.push(U)}R=-1/0,this.keyProps.forEach(F=>{F.lineF.line-D.line)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:R,modLeftPx:F,extraLeftPx:D}=this.getMetrics(),G=this.getAbsoluteX()-F-D;let U=0,W=0;const q=this.getStave().getSpacingBetweenLines()/2,Y=q*2;if(this.isRest()){const K=this.ys[0],Z=Flow.durationToFraction(this.duration);Z.equals(1)||Z.equals(2)?(U=K-q,W=K+q):(U=K-this.glyph.line_above*Y,W=K+this.glyph.line_below*Y)}else if(this.glyph.stem){const K=this.getStemExtents();K.baseY+=q*this.stem_direction,U=Math.min(K.topY,K.baseY),W=Math.max(K.topY,K.baseY)}else{U=null,W=null;for(let K=0;KF&&(F=G):G1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()&&this.renderFlag}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+getStemAdjustment(this)}getYForTopText(R){const F=this.getStemExtents();return Math.min(this.stave.getYForTopText(R),F.topY-this.render_options.annotation_spacing*(R+1))}getYForBottomText(R){const F=this.getStemExtents();return Math.max(this.stave.getYForTopText(R),F.baseY+this.render_options.annotation_spacing*R)}setStave(R){super.setStave(R);const F=this.note_heads.map(D=>(D.setStave(R),D.getY()));if(this.setYs(F),this.stem){const{y_top:D,y_bottom:G}=this.getNoteHeadBounds();this.stem.setYBounds(D,G)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(R){return this.displaced=R,this}getTieRightX(){let R=this.getAbsoluteX();return R+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(R+=this.modifierContext.getExtraRightPx()),R}getTieLeftX(){let R=this.getAbsoluteX();return R+=this.x_shift-this.extraLeftPx,R}getLineForRest(){let R=this.keyProps[0].line;if(this.keyProps.length>1){const F=this.keyProps[this.keyProps.length-1].line,D=Math.max(R,F),G=Math.min(R,F);R=Vex.MidLine(D,G)}return R}getModifierStartXY(R,F,D){if(D=D||{},!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:G,BELOW:U,LEFT:W,RIGHT:q}=Modifier.Position;let Y=0;return R===W?Y=-1*2:R===q?(Y=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===Stem.UP&&this.hasFlag()&&(D.forceFlagRight||isInnerNoteIndex(this,F))&&(Y+=this.flag.getMetrics().width)):(R===U||R===G)&&(Y=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+Y,y:this.ys[F]}}setStyle(R){super.setStyle(R),this.note_heads.forEach(F=>F.setStyle(R)),this.stem&&this.stem.setStyle(R)}setStemStyle(R){this.stem&&this.getStem().setStyle(R)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(R){this.ledgerLineStyle=R}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(R){this.flagStyle=R}getFlagStyle(){return this.flagStyle}setKeyStyle(R,F){return this.note_heads[R].setStyle(F),this}setKeyLine(R,F){return(this.glyph.code_head=="va5"||this.glyph.code_head=="v3c")&&(F=3),this.keyProps[R].line=F,this.reset(),this}getKeyLine(R){return this.keyProps[R].line}addToModifierContext(R){this.setModifierContext(R);for(let F=0;F{const Q=j.getLine(),J=j.getY();(R===null||JF)&&(F=J),G===null&&j.isDisplaced()&&(G=j.getAbsoluteX()),D===null&&!j.isDisplaced()&&(D=j.getAbsoluteX()),U=Q>U?Q:U,W=Q{let he;fe&&le?he=ne-D:le?he=te-D:he=J-D;const ge=le&&fe?W:U;G.beginPath(),G.moveTo(he,oe),G.lineTo(he+ge,oe),G.stroke()},re={...R.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(G,re);for(let oe=6;oe<=q;++oe){const le=te!==null&&oe<=Z,fe=J!==null&&oe<=K;ie(R.getYForNote(oe),le,fe)}for(let oe=0;oe>=Y;--oe){const le=te!==null&&oe>=Q,fe=J!==null&&oe>=j;ie(R.getYForNote(oe),le,fe)}this.restoreStyle(G,re)}drawVibrato(){if(this.vibrato){const R=this.context;R.openGroup("vibrato");const F=this.vibrato.getNoteHeadEndX()+2,{y_top:D}=this.vibrato.getNoteHeadBounds();let{y_bottom:G}=this.getNoteHeadBounds(),U=Math.abs(this.getNoteHeadBeginX()-F)-10;this.vibrato.stave.y!==this.stave.y&&(U=30,G=D+10),StaveNote.renderVibrato(this.context,F,D,{harsh:!0,vibrato_width:U,wave_height:6,wave_width:4,wave_girth:2},G),R.closeGroup()}}drawModifiers(){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");const R=this.context;R.openGroup("modifiers");for(let F=0;F6.5||j<-.5)&&(Z=Z+(j>6.5?(j-6.5)*10:(j+.5)*10))}D.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(D,this.getFlagStyle()||!1),this.flag.render(D,K,Z),this.restoreStyle(D,this.getFlagStyle()||!1),D.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(R=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const F=this.stave.options.line_config.filter(G=>G.visible).length;this.keyProps[0].line===4&&F<5&&R.setY(R.getY()+10),F===1&&R.setLine(3)}}catch{}R.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(R){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");R&&this.setStem(new Stem(R)),this.stem.id=Vex.Prefix(`${this.getAttribute("id")}-stem`),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}draw(){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new Vex.RERR("NoYValues","Can't draw note without Y values.");const R=this.stave.getLines();if(R===2||R===3||R===4)for(let G=0;GG.setX(F)),this.stem){let G=this.getStemX();const U=this.keyProps[0].line;(U>6.5||U<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=U>6.5?(U-6.5)*10:Math.abs(U+.5)*10)),this.stem.setNoteHeadXBounds(G,G)}L$i("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),D&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class FretHandFinger extends Modifier{static get CATEGORY(){return"frethandfinger"}static format(R,F){const{left_shift:D,right_shift:G}=F,U=1;if(!R||R.length===0)return!1;const W=[];let q=null,Y=0,K=0;for(let ie=0;iere.line-ie.line);let Z=0,j=0,Q=0,J=0,te=null,ne=null;for(let ie=0;ieQ?re:Q):le===Modifier.Position.RIGHT&&(fe.setXShift(j),re=K+me,J=re>J?re:J),te=he,ne=oe}return F.left_shift+=Q,F.right_shift+=J,!0}constructor(R){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=R,this.width=7,this.position=Modifier.Position.LEFT,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return FretHandFinger.CATEGORY}setFretHandFinger(R){return this.finger=R,this}setOffsetX(R){return this.x_offset=R,this}setOffsetY(R){return this.y_offset=R,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const R=this.context,F=this.note.getModifierStartXY(this.position,this.index);let D=F.x+this.x_shift+this.x_offset,G=F.y+this.y_shift+this.y_offset+5;switch(this.position){case Modifier.Position.ABOVE:D-=4,G-=12;break;case Modifier.Position.BELOW:D-=2,G+=10;break;case Modifier.Position.LEFT:D-=this.width;break;case Modifier.Position.RIGHT:D+=1;break;default:throw new Vex.RERR("InvalidPostion",`The position ${this.position} does not exist`)}R.save(),R.setFont(this.font.family,this.font.size,this.font.weight),R.fillText(""+this.finger,D,G),R.restore()}}class Music{static get NUM_TONES(){return 12}static get roots(){return["c","d","e","f","g","a","b"]}static get root_values(){return[0,2,4,5,7,9,11]}static get root_indices(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonical_notes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonic_intervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonic_accidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],mixolydian:[2,2,1,2,2,1,2],minor:[2,1,2,2,1,2,2]}}static get scaleTypes(){return{M:Music.scales.major,m:Music.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{root_index:0,int_val:0},cn:{root_index:0,int_val:0},"c#":{root_index:0,int_val:1},"c##":{root_index:0,int_val:2},cb:{root_index:0,int_val:11},cbb:{root_index:0,int_val:10},d:{root_index:1,int_val:2},dn:{root_index:1,int_val:2},"d#":{root_index:1,int_val:3},"d##":{root_index:1,int_val:4},db:{root_index:1,int_val:1},dbb:{root_index:1,int_val:0},e:{root_index:2,int_val:4},en:{root_index:2,int_val:4},"e#":{root_index:2,int_val:5},"e##":{root_index:2,int_val:6},eb:{root_index:2,int_val:3},ebb:{root_index:2,int_val:2},f:{root_index:3,int_val:5},fn:{root_index:3,int_val:5},"f#":{root_index:3,int_val:6},"f##":{root_index:3,int_val:7},fb:{root_index:3,int_val:4},fbb:{root_index:3,int_val:3},g:{root_index:4,int_val:7},gn:{root_index:4,int_val:7},"g#":{root_index:4,int_val:8},"g##":{root_index:4,int_val:9},gb:{root_index:4,int_val:6},gbb:{root_index:4,int_val:5},a:{root_index:5,int_val:9},an:{root_index:5,int_val:9},"a#":{root_index:5,int_val:10},"a##":{root_index:5,int_val:11},ab:{root_index:5,int_val:8},abb:{root_index:5,int_val:7},b:{root_index:6,int_val:11},bn:{root_index:6,int_val:11},"b#":{root_index:6,int_val:0},"b##":{root_index:6,int_val:1},bb:{root_index:6,int_val:10},bbb:{root_index:6,int_val:9}}}isValidNoteValue(R){return!(R==null||R<0||R>=Music.NUM_TONES)}isValidIntervalValue(R){return this.isValidNoteValue(R)}getNoteParts(R){if(!R||R.length<1)throw new Vex.RERR("BadArguments","Invalid note name: "+R);if(R.length>3)throw new Vex.RERR("BadArguments","Invalid note name: "+R);const F=R.toLowerCase(),G=/^([cdefgab])(b|bb|n|#|##)?$/.exec(F);if(G!=null){const U=G[1],W=G[2];return{root:U,accidental:W}}else throw new Vex.RERR("BadArguments","Invalid note name: "+R)}getKeyParts(R){if(!R||R.length<1)throw new Vex.RERR("BadArguments","Invalid key: "+R);const F=R.toLowerCase(),G=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(F);if(G!=null){const U=G[1],W=G[2];let q=G[3];return q||(q="M"),{root:U,accidental:W,type:q}}else throw new Vex.RERR("BadArguments",`Invalid key: ${R}`)}getNoteValue(R){const F=Music.noteValues[R];if(F==null)throw new Vex.RERR("BadArguments",`Invalid note name: ${R}`);return F.int_val}getIntervalValue(R){const F=Music.intervals[R];if(F==null)throw new Vex.RERR("BadArguments",`Invalid interval name: ${R}`);return F}getCanonicalNoteName(R){if(!this.isValidNoteValue(R))throw new Vex.RERR("BadArguments",`Invalid note value: ${R}`);return Music.canonical_notes[R]}getCanonicalIntervalName(R){if(!this.isValidIntervalValue(R))throw new Vex.RERR("BadArguments",`Invalid interval value: ${R}`);return Music.diatonic_intervals[R]}getRelativeNoteValue(R,F,D){if(D==null&&(D=1),D!==1&&D!==-1)throw new Vex.RERR("BadArguments",`Invalid direction: ${D}`);let G=(R+D*F)%Music.NUM_TONES;return G<0&&(G+=Music.NUM_TONES),G}getRelativeNoteName(R,F){const D=this.getNoteParts(R),G=this.getNoteValue(D.root);let U=F-G;if(Math.abs(U)>Music.NUM_TONES-3){let q=1;U>0&&(q=-1);const Y=(F+1+(G+1))%Music.NUM_TONES*q;if(Math.abs(Y)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${R}, ${F})`);U=Y}if(Math.abs(U)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${R}, ${F})`);let W=D.root;if(U>0)for(let q=1;q<=U;++q)W+="#";else if(U<0)for(let q=-1;q>=U;--q)W+="b";return W}getScaleTones(R,F){const D=[R];let G=R;for(let U=0;UB.getMetrics().width;class Accidental extends Modifier{static get CATEGORY(){return"accidentals"}static format(R,F){const G=F.left_shift+1,U=3;if(!R||R.length===0)return;const W=[];let q=null,Y=0,K;for(let oe=0;oele.line-oe.line);const Z=[];let j=0,Q=null;for(let oe=0;oej?le.shift:j,Q=le.line}let J=0;for(let oe=0;oeZ[fe+ue],ce=ue=>ue.map(ge),me=(ue,_e)=>{const[Be,Ae]=ce([ue,_e]).map(Pe=>Pe.line);return Be-Ae},ye=(...ue)=>ue.map(ce).every(_e=>!this.checkCollision(..._e)),ve=he-fe+1;let pe=this.checkCollision(Z[fe],Z[he])?"a":"b";switch(ve){case 3:pe==="a"&&me(1,2)===.5&&me(0,1)!==.5&&(pe="second_on_bottom");break;case 4:ye([0,2],[1,3])&&(pe="spaced_out_tetrachord");break;case 5:pe==="b"&&ye([1,3])&&(pe="spaced_out_pentachord",ye([0,2],[2,4])&&(pe="very_spaced_out_pentachord"));break;case 6:ye([0,3],[1,4],[2,5])&&(pe="spaced_out_hexachord"),ye([0,2],[2,4],[1,3],[3,5])&&(pe="very_spaced_out_hexachord");break}let be,xe;if(ve>=7){let ue=2,_e=!0;for(;_e===!0;){_e=!1;for(let Be=0;Be+uexe?J:xe}else for(be=oe;be<=he;be++)xe=Flow.accidentalColumnsTable[ve][pe][be-oe],Z[be].column=xe,J=J>xe?J:xe;oe=he}const te=[],ne=[];for(let oe=0;oe<=J;oe++)te[oe]=0,ne[oe]=0;te[0]=j+G,ne[0]=j+G,Z.forEach(oe=>{oe.width>te[oe.column]&&(te[oe.column]=oe.width)});for(let oe=1;oe{let le=0;const fe=re+oe.numAcc;for(re;re0?(G=F.flatLine||F.dblSharpLine?2.5:3,R.dblSharpLine&&(D-=.5)):(G=R.flatLine||R.dblSharpLine?2.5:3,F.dblSharpLine&&(D-=.5));const U=Math.abs(D){const Y=new Fraction(0,1);q.getTickables().forEach(Z=>{if(Z.shouldIgnoreTicks())return;const j=G[Y.value()];j?j.push(Z):(D.push(Y.value()),G[Y.value()]=[Z]),Y.add(Z.getTicks())})});const U=new Music;F||(F="C");const W=U.createScaleMap(F);D.forEach(q=>{const Y=G[q],K=[],Z=j=>{j.isRest()||j.shouldIgnoreTicks()||(j.keys.forEach((Q,J)=>{const te=U.getNoteParts(Q.split("/")[0]),ne=te.accidental||"n",ie=te.root+ne,re=W[te.root]===ie,oe=K.indexOf(ie)>-1;if(!re||re&&oe){W[te.root]=ie;const le=new Accidental(ne);j.addAccidental(J,le),K.push(ie)}}),j.getModifiers().forEach(Q=>{Q.getCategory()==="gracenotegroups"&&Q.getGraceNotes().forEach(Z)}))};Y.forEach(Z)})}constructor(R=null){if(super(),this.setAttribute("type","Accidental"),L$h("New accidental: ",R),this.note=null,this.index=null,this.type=R,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=Flow.accidentalCodes(this.type),!this.accidental)throw new Vex.RERR("ArgumentError",`Unknown accidental type: ${R}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const R=this.render_options.font_scale;this.glyph=new Glyph(this.accidental.code,R),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new Glyph(Flow.accidentalCodes("{").code,R),this.parenRight=new Glyph(Flow.accidentalCodes("}").code,R),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return Accidental.CATEGORY}getWidth(){const R=this.cautionary?getGlyphWidth(this.parenLeft)+getGlyphWidth(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return getGlyphWidth(this.glyph)+R}setNote(R){if(!R)throw new Vex.RERR("ArgumentError",`Bad note value: ${R}`);this.note=R,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){const{context:R,type:F,position:D,note:G,index:U,cautionary:W,x_shift:q,y_shift:Y,glyph:K,parenLeft:Z,parenRight:j,render_options:{parenLeftPadding:Q,parenRightPadding:J}}=this;if(this.checkContext(),!(G&&U!=null))throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const te=G.getModifierStartXY(D,U);let ne=te.x+q;const ie=te.y+Y;L$h("Rendering: ",F,ne,ie),W?(j.render(R,ne,ie),ne-=getGlyphWidth(j),ne-=J,ne-=this.accidental.parenRightPaddingAdjustment,K.render(R,ne,ie),ne-=getGlyphWidth(K),ne-=Q,Z.render(R,ne,ie)):K.render(R,ne,ie),this.setRendered()}}class NoteSubGroup$1 extends Modifier{static get CATEGORY(){return"notesubgroup"}static format(R,F){if(!R||R.length===0)return!1;let D=0;for(let G=0;G{F.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new Formatter,this.voice=new Voice$1({num_beats:4,beat_value:4,resolution:Flow.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return NoteSubGroup$1.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(R){this.note=R}setWidth(R){this.width=R}getWidth(){return this.width}draw(){this.checkContext();const R=this.getNote();if(!(R&&this.index!==null))throw new Vex.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,R),this.subNotes.forEach(F=>F.setContext(this.context).drawWithStyle())}}class StaveTie extends Element$2{constructor(R,F){super(),this.setAttribute("type","StaveTie"),this.notes=R,this.context=null,this.text=F,this.direction=null,this.render_options={cp1:8,cp2:12,text_shift_x:0,first_x_shift:0,last_x_shift:0,y_shift:7,tie_spacing:0,font:{family:"Arial",size:15,style:""}},this.font=this.render_options.font,this.setNotes(R)}setFont(R){return this.font=R,this}setDirection(R){return this.direction=R,this}setNotes(R){if(!R.first_note&&!R.last_note)throw new Vex.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(R.first_indices||(R.first_indices=[0]),R.last_indices||(R.last_indices=[0]),R.first_indices.length!==R.last_indices.length)throw new Vex.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=R.first_note,this.first_indices=R.first_indices,this.last_note=R.last_note,this.last_indices=R.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(R){if(R.first_ys.length===0||R.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const F=this.context;let D=this.render_options.cp1,G=this.render_options.cp2;Math.abs(R.last_x_px-R.first_x_px)<10&&(D=2,G=8);const U=this.render_options.first_x_shift,W=this.render_options.last_x_shift,q=this.render_options.y_shift*R.direction;for(let Y=0;YQ&&Math.abs(Z-Q)<10?-6:0;if(this.first_note&&this.first_note.DYMusicScoreType==="jianpu"){if(this.getAttribute("type")==="TabTie")continue;Z1){const F=new Beam$1(R);F.render_options.beam_width=3,F.render_options.partial_beam_length=4,this.beams.push(F)}return this}setNote(R){this.note=R}setWidth(R){this.width=R}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const R=this.getNote();if(L$g("Drawing grace note group for:",R),!(R&&this.index!==null))throw new Vex.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),R),this.grace_notes.forEach(F=>{F.setContext(this.context).draw()}),this.beams.forEach(F=>{F.setContext(this.context).draw()}),this.show_slur){const F=this.getNote().getCategory()===StaveNote.CATEGORY,D=F?StaveTie:TabTie;this.slur=new D({last_note:this.grace_notes[0],first_note:R,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(F?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}class Stroke extends Modifier{static get CATEGORY(){return"strokes"}static get Type(){return{BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASQUEDO_DOWN:5,RASQUEDO_UP:6,ARPEGGIO_DIRECTIONLESS:7}}static format(R,F){const D=F.left_shift,G=0;if(!R||R.length===0)return this;const U=R.map(Y=>{const K=Y.getNote();if(K instanceof StaveNote){const{line:Z,displaced:j}=K.getKeyProps()[Y.getIndex()],Q=j?K.getExtraLeftPx():0;return{line:Z,shift:Q,stroke:Y}}else{const{str:Z}=K.getPositions()[Y.getIndex()];return{line:Z,shift:0,stroke:Y}}}),W=D,q=U.reduce((Y,{stroke:K,shift:Z})=>(K.setXShift(W+Z),Math.max(K.getWidth()+G,Y)),0);return F.left_shift+=q,!0}constructor(R,F){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=Vex.Merge({},F),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=R,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,stroke_spacing:10},this.font={family:"serif",size:10,weight:"bold italic"},this.setXShift(0),this.setWidth(10)}getCategory(){return Stroke.CATEGORY}getPosition(){return this.position}addEndNote(R){return this.note_end=R,this}draw(){if(this.checkContext(),this.setRendered(),!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw stroke without a note and index.");const R=this.note.getModifierStartXY(this.position,this.index);let F=this.note.getYs(),D=R.y,G=R.y;const U=R.x-5,W=this.note.stave.options.spacing_between_lines_px,q=this.getModifierContext().getModifiers(this.note.getCategory());for(let J=0;Jhe.line-fe.line);let ne=0,ie=0,re=0,oe=null,le=null;for(Z=0;Zie?fe:ie):J===Modifier.Position.RIGHT&&(j.setXShift(ne),fe+=ce,re=fe>re?fe:re),oe=he,le=Q}return F.left_shift+=ie,F.right_shift+=re,!0}constructor(R){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=R,this.setWidth(20),this.position=Modifier.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=Renderer.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return StringNumber.CATEGORY}getNote(){return this.note}setNote(R){return this.note=R,this}getIndex(){return this.index}setIndex(R){return this.index=R,this}setLineEndType(R){return R>=Renderer.LineEndType.NONE&&R<=Renderer.LineEndType.DOWN&&(this.leg=R),this}setStringNumber(R){return this.string_number=R,this}setOffsetX(R){return this.x_offset=R,this}setOffsetY(R){return this.y_offset=R,this}setLastNote(R){return this.last_note=R,this}setDashed(R){return this.dashed=R,this}draw(){const R=this.checkContext();if(!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const F=this.note.stave.options.spacing_between_lines_px,D=this.note.getModifierStartXY(this.position,this.index);let G=D.x+this.x_shift+this.x_offset,U=D.y+this.y_shift+this.y_offset;switch(this.position){case Modifier.Position.ABOVE:case Modifier.Position.BELOW:{const q=this.note.getStemExtents();let Y=q.topY,K=q.baseY+2;this.note.stem_direction===StaveNote.STEM_DOWN&&(Y=q.baseY,K=q.topY-2),this.position===Modifier.Position.ABOVE?U=this.note.hasStem()?Y-F*1.75:D.y-F*1.75:U=this.note.hasStem()?K+F*1.5:D.y+F*1.75,U+=this.y_shift+this.y_offset;break}case Modifier.Position.LEFT:G-=this.radius/2+5;break;case Modifier.Position.RIGHT:G+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}R.save(),R.beginPath(),R.arc(G,U,this.radius,0,Math.PI*2,!1),R.lineWidth=1.5,R.stroke(),R.setFont(this.font.family,this.font.size,this.font.weight);const W=G-R.measureText(this.string_number).width/2;if(R.fillText(""+this.string_number,W,U+4.5),this.last_note!=null){const q=this.last_note.getStemX()-this.note.getX()+5;R.strokeStyle="#000000",R.lineCap="round",R.lineWidth=.6,this.dashed?Renderer.drawDashedLine(R,G+10,U,G+q,U,[3,3]):Renderer.drawDashedLine(R,G+10,U,G+q,U,[3,0]);let Y,K;switch(this.leg){case Renderer.LineEndType.UP:Y=-10,K=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(R,G+q,U,G+q,U+Y,K);break;case Renderer.LineEndType.DOWN:Y=10,K=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(R,G+q,U,G+q,U+Y,K);break}}R.restore()}}function L$f(...B){Articulation$1.DEBUG&&Vex.L("Vex.Flow.Articulation",B)}const{ABOVE,BELOW}=Modifier.Position,roundToNearestHalf=(B,R)=>B(R/.5)*.5,isWithinLines=(B,R)=>R===ABOVE?B<=5:B>=1,getRoundingFunction=(B,R)=>isWithinLines(B,R)?R===ABOVE?Math.ceil:Math.floor:Math.round,snapLineToStaff=(B,R,F,D)=>{const G=roundToNearestHalf(getRoundingFunction(R,F),R),U=B&&isWithinLines(G,F),W=G%1===0;return U&&W?G+.5*-D:G},isStaveNote=B=>{const R=B.getCategory();return R==="stavenotes"||R==="gracenotes"},isTabNote=B=>{const R=B.getCategory();return R==="tabnotes"||R==="numberednotes"},getTopY=(B,R)=>{const F=B.getStave(),D=B.getStemDirection(),{topY:G,baseY:U}=B.getStemExtents();if(isStaveNote(B))return B.hasStem()?D===Stem.UP?G:U:Math.min(...B.getYs());if(isTabNote(B))return B.hasStem()&&D===Stem.UP?G:F.getYForTopText(R);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=(B,R)=>{const F=B.getStave(),D=B.getStemDirection(),{topY:G,baseY:U}=B.getStemExtents();if(isStaveNote(B))return B.hasStem()?D===Stem.UP?U:G:Math.max(...B.getYs());if(isTabNote(B))return B.hasStem()?D===Stem.UP?F.getYForBottomText(R):G:F.getYForBottomText(R);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=(B,R)=>{const F=R===ABOVE&&B.getStemDirection()===Stem.UP||R===BELOW&&B.getStemDirection()===Stem.DOWN;return isStaveNote(B)?B.hasStem()&&F?.5:1:B.hasStem()&&F?1:0};class Articulation$1 extends Modifier{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(R,F){if(!R||R.length===0)return!1;const D=Y=>Y.getPosition()===ABOVE,G=Y=>Y.getPosition()===BELOW,U=.5,W=(Y,K,Z)=>roundToNearestHalf(getRoundingFunction(K,Z),Y.glyph.getMetrics().height/10+U);R.filter(D).forEach(Y=>{Y.setTextLine(F.top_text_line),F.top_text_line+=W(Y,F.top_text_line,ABOVE)}),R.filter(G).forEach(Y=>{Y.setTextLine(F.text_line),F.text_line+=W(Y,F.text_line,BELOW)});const q=R.map(Y=>Y.getWidth()).reduce((Y,K)=>Math.max(K,Y));return F.left_shift+=q/2,F.right_shift+=q/2,!0}static easyScoreHook({articulations:R},F,D){if(!R)return;const G={staccato:"a.",tenuto:"a-"};R.split(",").map(U=>U.trim().split(".")).map(([U,W])=>{const q={type:G[U]};return W&&(q.position=Modifier.PositionString[W]),D.getFactory().Articulation(q)}).map(U=>F.addModifier(0,U))}constructor(R){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=R,this.position=BELOW,this.render_options={font_scale:38},this.articulation=Flow.articulationCodes(this.type),!this.articulation)throw new Vex.RERR("ArgumentError",`Articulation not found: ${this.type}`);this.glyph=new Glyph(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Articulation$1.CATEGORY}draw(){const{note:R,index:F,position:D,glyph:G,articulation:{between_lines:U},text_line:W,context:q}=this;if(this.checkContext(),!R||F==null)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const Y=R.getStave(),K=Y.getSpacingBetweenLines(),Z=R.getCategory()==="tabnotes",{x:j}=R.getModifierStartXY(D,F),Q=!U||Z,J=getInitialOffset(R,D);let te={[ABOVE]:()=>{G.setOrigin(.5,1);const ne=getTopY(R,W)-(W+J)*K+(this.y_shift||0);return Q?Math.min(Y.getYForTopText(Articulation$1.INITIAL_OFFSET),ne):ne},[BELOW]:()=>{G.setOrigin(.5,0);const ne=getBottomY(R,W)+(W+J)*K;return Q?Math.max(Y.getYForBottomText(Articulation$1.INITIAL_OFFSET),ne):ne}}[D]();if(!Z){const ne=D===ABOVE?-1:1,ie=Z?R.positions[F].str:R.getKeyProps()[F].line,oe=(R.getYs()[F]-te)/K+ie,le=snapLineToStaff(U,oe,D,ne);isWithinLines(le,D)&&G.setOrigin(.5,.5),te+=Math.abs(le-oe)*K*ne}L$f(`Rendering articulation at (x: ${j}, y: ${te})`),G.render(q,j,te)}}class TickContext extends Tickable{static getNextContext(R){const F=R.tContexts,D=F.indexOf(R);return F[D+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new Fraction(0,1),this.maxTicks=new Fraction(0,1),this.minTicks=null,this.padding=3,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.notePx=0,this.extraLeftPx=0,this.extraRightPx=0,this.tContexts=[]}getX(){return this.x}setX(R){return this.x=R,this.xBase=R,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(R){this.xBase=R,this.x=R+this.xOffset}getXOffset(){return this.xOffset}setXOffset(R){this.xOffset=R,this.x=this.xBase+R}getWidth(){return this.width+this.padding*2}setPadding(R){return this.padding=R,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(R=>R.isCenterAligned())}getMetrics(){const{width:R,notePx:F,extraLeftPx:D,extraRightPx:G}=this;return{width:R,notePx:F,extraLeftPx:D,extraRightPx:G}}getCurrentTick(){return this.currentTick}setCurrentTick(R){this.currentTick=R,this.preFormatted=!1}getExtraPx(){let R=0,F=0,D=0,G=0;for(let U=0;U0&&G--;for(let Y=0;Y{L$c("Preformatting ModifierContext: ",R.CATEGORY),R.format(this.getModifiers(R.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(R=>{L$c("Postformatting ModifierContext: ",R.CATEGORY),R.postFormat(this.getModifiers(R.CATEGORY),this)})}}function L$b(...B){Formatter.DEBUG&&Vex.L("Vex.Flow.Formatter",B)}function getNext(B,R){var D,G;const F=B[R+1];return F&&((D=F==null?void 0:F.keys)==null?void 0:D.includes("b/4"))||((G=F==null?void 0:F.keys)==null?void 0:G.includes("r/4"))?getNext(B,R+1):F}function lookAhead(B,R,F,D,G=0){let U=R;for(F+=1;F4.5||U<1.5)){const q=B[F].stem;if(q)if(q.stem_direction>0){const Y=U<1.5?Math.abs(U-1.5)*G:0;q.setResetHeight(Y)}else{const Y=U>4.5?Math.abs(U-4.5)*G:0;q.setResetHeight(Y)}}return U}function createContexts(B,R,F){if(!B||!B.length)throw new Vex.RERR("BadArgument","No voices to format");const D=B[0].getTotalTicks(),G=B.reduce((Y,K)=>{if(!K.getTotalTicks().equals(D))throw new Vex.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(K.getMode()===Voice$1.Mode.STRICT&&!K.isComplete())throw new Vex.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(Y,Fraction.LCM(Y,K.getResolutionMultiplier()))},1),U={},W=[],q=[];return B.forEach(Y=>{const K=new Fraction(0,G);Y.getTickables().forEach(Z=>{const j=K.numerator;if(!U[j]){const Q=new R;q.push(Q),U[j]=Q}F(Z,U[j]),W.push(j),K.add(Z.getTicks())})}),{map:U,array:q,list:Vex.SortAndUnique(W,(Y,K)=>Y-K,(Y,K)=>Y===K),resolutionMultiplier:G}}class Formatter{static SimpleFormat(R,F=0,{paddingBetween:D=10}={}){R.reduce((G,U)=>{U.addToModifierContext(new ModifierContext);const W=new TickContext().addTickable(U).preFormat(),q=W.getExtraPx();return W.setX(G+q.left),G+W.getWidth()+q.right+D},F)}static plotDebugging(R,F,D,G,U){const W=D+Note.STAVEPADDING,q=F.contextGaps;function Y(K,Z,j){R.beginPath(),R.setStrokeStyle(j),R.setFillStyle(j),R.setLineWidth(1),R.fillRect(K,G,Z-K,U-G)}R.save(),R.setFont("Arial",8,""),q.gaps.forEach(K=>{Y(W+K.x1,W+K.x2,"#aaa"),R.fillText(Math.round(K.x2-K.x1),W+K.x1,U+12)}),R.fillText(Math.round(q.total)+"px",W-20,U+12),R.setFillStyle("red"),R.fillText("Loss: "+F.lossHistory.map(K=>Math.round(K)),W-20,U+22),R.restore()}static FormatAndDraw(R,F,D,G){const U={auto_beam:!1,align_rests:!1};typeof G=="object"?Vex.Merge(U,G):typeof G=="boolean"&&(U.auto_beam=G);const W=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(D),q=U.auto_beam?Beam$1.applyAndGetBeams(W):[];return new Formatter().joinVoices([W],{align_rests:U.align_rests}).formatToStave([W],F,{align_rests:U.align_rests,stave:F}),W.setStave(F).draw(R,F),q.forEach(Y=>Y.setContext(R).draw()),W.getBoundingBox()}static FormatAndDrawTab(R,F,D,G,U,W,q){const Y={auto_beam:W,align_rests:!1};typeof q=="object"?Vex.Merge(Y,q):typeof q=="boolean"&&(Y.auto_beam=q);const K=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(U),Z=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(G),j=Y.auto_beam?Beam$1.applyAndGetBeams(K):[];new Formatter().joinVoices([K],{align_rests:Y.align_rests}).joinVoices([Z]).formatToStave([K,Z],D,{align_rests:Y.align_rests}),K.draw(R,D),Z.draw(R,F),j.forEach(Q=>Q.setContext(R).draw()),new StaveConnector(D,F).setContext(R).draw()}static AlignRestsToNotes(R,F,D){return R.forEach((G,U)=>{if(G instanceof StaveNote&&G.isRest()){if(G.tuplet&&!D)return;if(G.getGlyph().position.toUpperCase(),G.glyph.code_head==="va5"||G.glyph.code_head==="v3c"){const W=G.glyph.code_head==="va5"?10:20,q=R[U-1],Y=getNext(R,U);let K=!1;if(q&&Y&&q.beam&&Y.beam&&(K=q.beam.notes.includes(Y)),F||G.beam!=null||K){const Z=G.getKeyProps()[0];if(U===0)Z.line=lookAhead(R,Z.line,U,!1,W),G.setKeyLine(0,Z.line);else if(U>0&&UFormatter.AlignRestsToNotes(D.getTickables(),F))}preCalculateMinTotalWidth(R){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!R)throw new Vex.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(R)}const{list:F,map:D}=this.tickContexts;return this.minTotalWidth=F.map(G=>{const U=D[G];return U.preFormat(),U.getWidth()}).reduce((G,U)=>G+U,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new Vex.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(R){const F=createContexts(R,ModifierContext,(D,G)=>D.addToModifierContext(G));return this.modiferContexts=F,F}createTickContexts(R){const F=createContexts(R,TickContext,(D,G)=>G.addTickable(D));return F.array.forEach(D=>{D.tContexts=F.array}),this.totalTicks=R[0].getTicksUsed().clone(),this.tickContexts=F,F}preFormat(R=0,F,D,G){const U=this.tickContexts,{list:W,map:q,resolutionMultiplier:Y}=U;D&&G&&D.forEach(ne=>ne.setStave(G).preFormat());let K=0,Z=0;const j=R/2;if(this.minTotalWidth=0,W.forEach(ne=>{const ie=q[ne];F&&ie.setContext(F),ie.preFormat();const re=ie.getWidth();this.minTotalWidth+=re;const oe=ie.getMetrics();K=K+Z+oe.extraLeftPx,ie.setX(K),Z=re-oe.extraLeftPx}),this.minTotalWidth=K+Z,this.hasMinTotalWidth=!0,R<=0)return;const J=(R-this.minTotalWidth)/(this.totalTicks.value()*Y);let te=0;W.forEach((ne,ie)=>{const re=W[ie-1]||0,oe=q[ne];te+=(ne-re)*J,oe.setX(oe.getX()+te),oe.getCenterAlignedTickables().forEach(fe=>{fe.center_x_shift=j-oe.getX()})}),W.length!==1&&(this.justifyWidth=R,this.lossHistory=[],this.evaluate())}evaluate(){const R=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((U,W)=>{if(W===0)return;const q=this.tickContexts.list[W-1],Y=this.tickContexts.map[q],K=this.tickContexts.map[U],Z=Y.getMetrics(),j=Y.getX()+Z.width,Q=K.getX(),J=Q-j;this.contextGaps.total+=J,this.contextGaps.gaps.push({x1:j,x2:Q}),K.getFormatterMetrics().freedom.left=J,Y.getFormatterMetrics().freedom.right=J});const F=this.durationStats={};function D(U,W){const q=F[U];q===void 0?F[U]={mean:W,count:1}:(q.count+=1,q.mean=(q.mean+W)/2)}this.voices.forEach(U=>{U.getTickables().forEach((W,q,Y)=>{const K=W.getTicks().clone().simplify().toString(),Z=W.getMetrics(),j=W.getFormatterMetrics(),Q=W.getX()+Z.noteWidth+Z.modRightPx+Z.extraRightPx;let J=0;if(q{U.getTickables().forEach(W=>{const q=W.getTicks().clone().simplify().toString(),Y=W.getFormatterMetrics();Y.iterations+=1,Y.space.deviation=Y.space.used-F[q].mean,Y.duration=q,Y.space.mean=F[q].mean,G+=Math.pow(F[q].mean,2)})}),this.totalCost=Math.sqrt(G),this.lossHistory.push(this.totalCost),this}tune(){const R=G=>G.reduce((U,W)=>U+W);function F(G,U,W,q){G.setX(G.getX()+q),G.getFormatterMetrics().freedom.left+=q,G.getFormatterMetrics().freedom.right-=q,U&&(U.getFormatterMetrics().freedom.right+=q),W&&(W.getFormatterMetrics().freedom.left-=q)}let D=0;return this.tickContexts.list.forEach((G,U,W)=>{const q=this.tickContexts.map[G],Y=U>0?this.tickContexts.map[W[U-1]]:null,K=UQ.getFormatterMetrics().space.deviation));Z>0?D=-Math.min(q.getFormatterMetrics().freedom.right,Math.abs(Z)):Z<0&&(K?D=Math.min(K.getFormatterMetrics().freedom.right,Math.abs(Z)):D=0);const j=Math.min(5,Math.abs(D));D=D>0?j:-j}),this.evaluate()}postFormat(){const R=F=>F.list.forEach(D=>F.map[D].postFormat());return R(this.modiferContexts),R(this.tickContexts),this}joinVoices(R){return this.createModifierContexts(R),this.hasMinTotalWidth=!1,this}format(R,F,D){const G={align_rests:!1,context:null,stave:null};return Vex.Merge(G,D),this.voices=R,this.alignRests(R,G.align_rests),this.createTickContexts(R),this.preFormat(F,G.context,R,G.stave),G.stave&&this.postFormat(),this}formatToStave(R,F,D){const G=F.getNoteEndX()-F.getNoteStartX()-10;L$b("Formatting voices to width: ",G);const U={context:F.getContext()};return Vex.Merge(U,D),this.format(R,G,U)}}class StaveModifier extends Element$2{static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}constructor(){super(),this.setAttribute("type","StaveModifier"),this.padding=10,this.position=StaveModifier.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(R){return this.position=R,this}getStave(){return this.stave}setStave(R){return this.stave=R,this}getWidth(){return this.width}setWidth(R){return this.width=R,this}getX(){return this.x}setX(R){return this.x=R,this}getCategory(){return""}makeSpacer(R){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:R}}}}placeGlyphOnLine(R,F,D){R.setYShift(F.getYForLine(D)-F.getYForGlyphs())}getPadding(R){return R!==void 0&&R<2?0:this.padding}setPadding(R){return this.padding=R,this}setLayoutMetrics(R){return this.layoutMetrics=R,this}getLayoutMetrics(){return this.layoutMetrics}}class Barline extends StaveModifier{static get CATEGORY(){return"barlines"}static get type(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}static get typeString(){return{single:Barline.type.SINGLE,double:Barline.type.DOUBLE,end:Barline.type.END,repeatBegin:Barline.type.REPEAT_BEGIN,repeatEnd:Barline.type.REPEAT_END,repeatBoth:Barline.type.REPEAT_BOTH,none:Barline.type.NONE}}constructor(R){super(),this.setAttribute("type","Barline"),this.thickness=Flow.STAVE_LINE_THICKNESS;const F=Barline.type;this.widths={},this.widths[F.SINGLE]=5,this.widths[F.DOUBLE]=5,this.widths[F.END]=5,this.widths[F.REPEAT_BEGIN]=5,this.widths[F.REPEAT_END]=5,this.widths[F.REPEAT_BOTH]=5,this.widths[F.NONE]=5,this.paddings={},this.paddings[F.SINGLE]=0,this.paddings[F.DOUBLE]=0,this.paddings[F.END]=0,this.paddings[F.REPEAT_BEGIN]=15,this.paddings[F.REPEAT_END]=15,this.paddings[F.REPEAT_BOTH]=15,this.paddings[F.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[F.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[F.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(StaveModifier.Position.BEGIN),this.setType(R)}getCategory(){return Barline.CATEGORY}getType(){return this.type}setType(R){return this.type=typeof R=="string"?Barline.typeString[R]:R,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(R){switch(R.checkContext(),this.setRendered(),this.type){case Barline.type.SINGLE:this.drawVerticalBar(R,this.x,!1);break;case Barline.type.DOUBLE:this.drawVerticalBar(R,this.x,!0);break;case Barline.type.END:this.drawVerticalEndBar(R,this.x);break;case Barline.type.REPEAT_BEGIN:this.drawRepeatBar(R,this.x,!0),R.getX()!==this.x&&this.drawVerticalBar(R,R.getX());break;case Barline.type.REPEAT_END:this.drawRepeatBar(R,this.x,!1);break;case Barline.type.REPEAT_BOTH:this.drawRepeatBar(R,this.x,!1),this.drawRepeatBar(R,this.x,!0);break}}drawVerticalBar(R,F,D){R.checkContext();const G=R.getTopLineTopY(),U=R.getBottomLineBottomY();D&&R.context.fillRect(F-3,G,1,U-G),R.context.fillRect(F,G,1,U-G)}drawVerticalEndBar(R,F){R.checkContext();const D=R.getTopLineTopY(),G=R.getBottomLineBottomY();R.context.fillRect(F-5,D,1,G-D),R.context.fillRect(F-2,D,3,G-D)}drawRepeatBar(R,F,D){R.checkContext();const G=R.getTopLineTopY(),U=R.getBottomLineBottomY();let W=3;D||(W=-5),R.context.fillRect(F+W,G,1,U-G),R.context.fillRect(F-2,G,3,U-G);const q=2;D?W+=4:W-=4;const Y=F+W+q/2;let K=(R.getNumLines()-1)*R.getSpacingBetweenLines();K=K/2-R.getSpacingBetweenLines()/2;let Z=G+K+q/2;R.context.beginPath(),R.context.arc(Y,Z,q,0,Math.PI*2,!1),R.context.fill(),Z+=R.getSpacingBetweenLines(),R.context.beginPath(),R.context.arc(Y,Z,q,0,Math.PI*2,!1),R.context.fill()}}class Repetition$1 extends StaveModifier{static get CATEGORY(){return"repetitions"}static get type(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13}}constructor(R,F,D){super(),this.setAttribute("type","Repetition"),this.symbol_type=R,this.x=F,this.x_shift=0,this.y_shift=D,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Repetition$1.CATEGORY}setShiftX(R){return this.x_shift=R,this}setShiftY(R){return this.y_shift=R,this}setX(R){return this.x=R,this}draw(R,F){switch(this.setRendered(),this.symbol_type){case Repetition$1.type.CODA_RIGHT:this.drawCodaFixed(R,F+R.width);break;case Repetition$1.type.CODA_LEFT:this.drawSymbolText(R,F,"Coda",!1);break;case Repetition$1.type.SEGNO_LEFT:this.drawSignoFixed(R,F);break;case Repetition$1.type.SEGNO_RIGHT:this.drawSignoFixed(R,F+R.width);break;case Repetition$1.type.DC:this.drawSymbolText(R,F,"D.C.",!1);break;case Repetition$1.type.DC_AL_CODA:this.drawSymbolText(R,F,"D.C. al Coda",!0);break;case Repetition$1.type.DC_AL_FINE:this.drawSymbolText(R,F,"D.C. al Fine",!1);break;case Repetition$1.type.DS:this.drawSymbolText(R,F,"D.S.",!1);break;case Repetition$1.type.DS_AL_CODA:this.drawSymbolText(R,F,"D.S. al Coda",!0);break;case Repetition$1.type.DS_AL_FINE:this.drawSymbolText(R,F,"D.S. al Fine",!1);break;case Repetition$1.type.FINE:this.drawSymbolText(R,F,"Fine",!1);break;case Repetition$1.type.TO_CODA:this.drawSymbolText(R,F,"To Coda",!0);break}return this}drawCodaFixed(R,F){const D=R.getYForTopText(R.options.num_lines)+this.y_shift;return Glyph.renderGlyph(R.context,this.x+F+this.x_shift,D+25,40,"v4d",!0),this}drawSignoFixed(R,F){const D=R.getYForTopText(R.options.num_lines)+this.y_shift;return Glyph.renderGlyph(R.context,this.x+F+this.x_shift,D+25,30,"v8c",!0),this}drawSymbolText(R,F,D,G){const U=R.checkContext();U.save(),U.setFont(this.font.family,this.font.size,this.font.weight);let W=0+this.x_shift,q=F+this.x_shift;this.symbol_type===Repetition$1.type.CODA_LEFT?(W=this.x+R.options.vertical_bar_width,q=W+U.measureText(D).width+12):(this.x_shift=-(W+U.measureText(D).width+12+R.options.vertical_bar_width+12),W=this.x+this.x_shift+R.options.vertical_bar_width,q=W+U.measureText(D).width+12);const Y=R.getYForTopText(R.options.num_lines)+this.y_shift+25;return G&&Glyph.renderGlyph(U,q,Y,40,"v4d",!0),U.fillText(D,W,Y+5),U.restore(),this}}class StaveSection extends StaveModifier{static get CATEGORY(){return"stavesection"}constructor(R,F,D){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=R,this.x=F,this.shift_x=0,this.shift_y=D,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return StaveSection.CATEGORY}setStaveSection(R){return this.section=R,this}setShiftX(R){return this.shift_x=R,this}setShiftY(R){return this.shift_y=R,this}draw(R,F){const D=R.checkContext();this.setRendered(),D.save(),D.lineWidth=2,D.setFont(this.font.family,this.font.size,this.font.weight);const G=D.measureText(""+this.section),U=G.width,W=G.height;let q=U+6;q<18&&(q=18);const Y=W,K=R.getYForTopText(3)+this.shift_y;let Z=this.x+F;return D.beginPath(),D.lineWidth=2,D.rect(Z,K+W/4,q,Y),D.stroke(),Z+=(q-U)/2,D.fillText(""+this.section,Z,K+16),D.restore(),this}}class StaveTempo extends StaveModifier{static get CATEGORY(){return"stavetempo"}constructor(R,F,D){super(),this.setAttribute("type","StaveTempo"),this.tempo=R,this.position=Modifier.Position.ABOVE,this.x=F,this.shift_x=10,this.shift_y=D,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return StaveTempo.CATEGORY}setTempo(R){return this.tempo=R,this}setShiftX(R){return this.shift_x=R,this}setShiftY(R){return this.shift_y=R,this}draw(R,F){const D=R.checkContext();this.setRendered();const G=this.render_options,U=G.glyph_font_scale/38,W=this.tempo.name,q=this.tempo.duration,Y=this.tempo.dots,K=this.tempo.bpm,Z=this.font;let j=this.x+this.shift_x+F;const Q=R.getYForTopText(1)+this.shift_y;if(D.save(),D.openGroup("stavetempo",null,{}),W&&(D.setFont(Z.family,Z.size,Z.weight),D.fillText(W,j,Q),j+=D.measureText(W).width),q&&K){D.setFont(Z.family,Z.size,"normal"),W&&(j+=D.measureText(" ").width,D.fillText("(",j,Q),j+=D.measureText("(").width);const J=Flow.getGlyphProps(q);if(j+=3*U,Glyph.renderGlyph(D,j,Q,G.glyph_font_scale,J.code_head),j+=J.getWidth()*U,J.stem){let te=30;J.beam_count&&(te+=3*(J.beam_count-1)),te*=U;const ne=Q-te;D.fillRect(j-U,ne,U,te),J.flag&&(Glyph.renderGlyph(D,j,ne,G.glyph_font_scale,J.code_flag_upstem),Y||(j+=6*U))}for(let te=0;te=R.line?Y.above:Y.below)}this.placeGlyphOnLine(G,this.stave,R.line),this.glyphs.push(G);const W=this.xPositions[this.xPositions.length-1],q=G.getMetrics().width+U;this.xPositions.push(W+q),this.width+=q}cancelKey(R){return this.formatted=!1,this.cancelKeySpec=R,this}convertToCancelAccList(R){const F=Flow.keySignature(R),D=this.accList.length>0&&F.length>0&&F[0].type!==this.accList[0].type,G=D?F.length:F.length-this.accList.length;if(G<1)return;const U=[];for(let W=0;W0?R[0].type:null;let D;if(this.cancelKeySpec&&(D=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const G=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;D&&this.convertAccLines(G,D.type,D.accList),this.convertAccLines(G,F,R);for(let U=0;U0){this.stave.context.openGroup("keysignature");for(let R=0;R{const R=B.split("/").filter(F=>F!=="");if(R.length!==2)throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${B}. Must be in the form "/"`);R.forEach(F=>{if(isNaN(Number(F)))throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${B}. Must contain two valid numbers.`)})};class TimeSignature extends StaveModifier{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(R=null,F=15,D=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=D,R===null)return;const G=F;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(StaveModifier.Position.BEGIN),this.setTimeSig(R),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(G)}getCategory(){return TimeSignature.CATEGORY}parseTimeSpec(R){if(R==="C"||R==="C|"){const{line:G,code:U,point:W}=TimeSignature.glyphs[R];return{line:G,num:!1,glyph:new Glyph(U,W)}}this.validate_args&&assertIsValidFraction(R);const[F,D]=R.split("/").map(G=>G.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(F,D)}}makeTimeSignatureGlyph(R,F){const D=new Glyph("v0",this.point);D.topGlyphs=[],D.botGlyphs=[];let G=0;for(let j=0;jU?G:U,q=D.getMetrics().x_min;D.getMetrics=()=>({x_min:q,x_max:q+W,width:W});const Y=(W-G)/2,K=(W-U)/2,Z=this;return D.renderToStave=function(Q){let J=Q+Y;for(let te=0;teF.visible).filter(Boolean).length}getOptions(){return this.options}setNoteStartX(R){this.formatted||this.format(),this.setStartX(R);const F=this.modifiers[0];return F.setX(this.start_x-F.getWidth()),this}setStartX(R){this.start_x=R}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(R){return this.options.num_lines=parseInt(R,10),this.resetLines(),this}setY(R){return this.y=R,this}getTopLineTopY(){return this.getYForLine(0)-Flow.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getLines()===2?this.getYForLine(6)+Flow.STAVE_LINE_THICKNESS/2:this.getYForLine(this.getNumLines()-1)+Flow.STAVE_LINE_THICKNESS/2}setX(R){const F=R-this.x;this.formatted=!1,this.x=R,this.start_x+=F,this.end_x+=F;for(let D=0;DD.getWidth()&&(F-=D.getWidth()),F}setRepetitionTypeLeft(R,F){return this.modifiers.push(new Repetition$1(R,this.x,F)),this}setRepetitionTypeRight(R,F){return this.modifiers.push(new Repetition$1(R,this.x,F)),this}setVoltaType(R,F,D){if(R===2)volta.type===2&&volta.stave.modifiers.push(new Volta(volta.type,volta.number_t,volta.x,volta.y)),volta={stave:this,type:R,number_t:F,MeasureNumber:this.MeasureNumber,y:D,x:this.x};else if(R===4){let G=this.MeasureNumber-volta.MeasureNumber,U=Math.max(volta.y,D);for(let W=0;W<=G;W++)voltaMeasureNumber[volta.MeasureNumber+W]={type:W===0?2:W===G?4:0,number_t:F,y:U};volta={}}else this.modifiers.push(new Volta(R,F,this.x,D));return this}drawVolta(){let R=voltaMeasureNumber[this.MeasureNumber];R&&(this.modifiers.push(new Volta(R.type,R.number_t,this.x,R.y)),delete voltaMeasureNumber[this.MeasureNumber]),volta.type&&volta.MeasureNumber==this.MeasureNumber&&(this.modifiers.push(new Volta(volta.type,volta.number_t,this.x,volta.y)),volta={})}setSection(R,F,D=0,G=12){const U=new StaveSection(R,this.x+D,F);return U.font.size=G,this.modifiers.push(U),this}setTempo(R,F){return this.modifiers.push(new StaveTempo(R,this.x,F)),this}setText(R,F,D){let G=new StaveText(R,F,D);return G.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(G),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new BoundingBox$1(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const R=this.options,F=R.spacing_between_lines_px;return this.getYForLine(R.num_lines)+R.space_below_staff_ln*F}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(R){const F=this.options,D=F.spacing_between_lines_px,G=F.space_above_staff_ln;return this.y+R*D+G*D}getLineForY(R){const F=this.options,D=F.spacing_between_lines_px,G=F.space_above_staff_ln;return(R-this.y)/D-G}getYForTopText(R){const F=R||0;return this.getYForLine(-F-this.options.top_text_position)}getYForBottomText(R){const F=R||0;return this.getYForLine(this.options.bottom_text_position+F)}getYForNote(R){const F=this.options,D=F.spacing_between_lines_px,G=F.space_above_staff_ln;return this.y+G*D+5*D-R*D}getYForGlyphs(){return this.getYForLine(3)}addModifier(R,F,D){return F!==void 0&&R.setPosition(F),D&&(this.timeSignature.numerator=D.numerator,this.timeSignature.denominator=D.denominator),R.setStave(this),this.formatted=!1,this.modifiers.push(R),this}addEndModifier(R){return this.addModifier(R,StaveModifier.Position.END),this}setBegBarType(R){const{SINGLE:F,REPEAT_BEGIN:D,NONE:G}=Barline.type;return(R===F||R===D||R===G)&&(this.modifiers[0].setType(R),this.formatted=!1),this}setEndBarType(R){return R!==Barline.type.REPEAT_BEGIN&&(this.modifiers[1].setType(R),this.formatted=!1),this}setClef(R,F,D,G){G===void 0&&(G=StaveModifier.Position.BEGIN),G===StaveModifier.Position.END?this.endClef=R:this.clef=R;const U=this.getModifiers(G,Clef.CATEGORY);return U.length===0?this.addClef(R,F,D,G):U[0].setType(R,F,D),this}setEndClef(R,F,D){return this.setClef(R,F,D,StaveModifier.Position.END),this}setKeySignature(R,F,D){this.options.keySignature=R,D===void 0&&(D=StaveModifier.Position.BEGIN);const G=this.getModifiers(D,KeySignature.CATEGORY);return G.length===0?this.options.DYMusicScoreType!=="jianpu"&&this.addKeySignature(R,F,D):G[0].setKeySig(R,F),this}setEndKeySignature(R,F){return this.setKeySignature(R,F,StaveModifier.Position.END),this}setTimeSignature(R,F,D){D===void 0&&(D=StaveModifier.Position.BEGIN);const G=this.getModifiers(D,TimeSignature.CATEGORY);return G.length===0?this.addTimeSignature(R,F,D):G[0].setTimeSig(R),this}setEndTimeSignature(R,F){return this.setTimeSignature(R,F,StaveModifier.Position.END),this}addKeySignature(R,F,D){return D===void 0&&(D=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(R,F).setPosition(D),D),this}addClef(R,F,D,G){return G===void 0||G===StaveModifier.Position.BEGIN?this.clef=R:G===StaveModifier.Position.END&&(this.endClef=R),this.addModifier(new Clef(R,F,D),G),this}addEndClef(R,F,D){return this.addClef(R,F,D,StaveModifier.Position.END),this}addTimeSignature(R,F,D){return this.addModifier(new TimeSignature(R,F),D),this}addEndTimeSignature(R,F){return this.addTimeSignature(R,F,StaveModifier.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(R,F){return R===void 0&&F===void 0?this.modifiers:this.modifiers.filter(D=>(R===void 0||R===D.getPosition())&&(F===void 0||F===D.getCategory()))}sortByCategory(R,F){for(let D=R.length-1;D>=0;D--)for(let G=0;GF[R[G+1].getCategory()]){const U=R[G];R[G]=R[G+1],R[G+1]=U}}format(){const R=this.modifiers[0],F=this.modifiers[1],D=this.getModifiers(StaveModifier.Position.BEGIN),G=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(D,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(G,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),D.length>1&&R.getType()===Barline.type.REPEAT_BEGIN&&(D.push(D.splice(0,1)[0]),D.splice(0,0,new Barline(Barline.type.SINGLE))),G.indexOf(F)>0&&G.splice(0,0,new Barline(Barline.type.NONE));let U,W,q,Y=0,K=this.x;for(let Q=0;Q{W.includes(Y)?q.visible=!0:q.visible=!1})}for(let W=0;Wthis.drawStaveTempo()),this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const W=this.context.measureText(""+this.measure).width;G=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-W/2,G),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const R=document.querySelector(`#${this.attrs.id}`);if(!R)return;const F=R.parentElement.getBBox(),D=this.getYForLine(0),G=R.parentElement.parentElement.querySelectorAll(".vf-curve");if(G.length){const U=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),W=this.getYForTopText(1)+F.y-D+5;G.forEach(q=>{const Y=q.getBBox();Y.x-10U&&Y.y-10W&&(F.y=Y.y+5)})}for(let U=0;U=0&&this.timeSignature.numerator){let R=40,F=0;this.MeasureNumber<2&&(R=70,F=-72),this.setText(`${this.timeSignature.numerator}`,1,{justification:1,shift_x:R,shift_y:F-13}),this.setText("\u1173",1,{justification:1,shift_x:R+3,shift_y:F-2}),this.setText(`${this.timeSignature.denominator}`,1,{justification:1,shift_x:R,shift_y:F+8})}}drawVertical(R,F){this.drawVerticalFixed(this.x+R,F)}drawVerticalFixed(R,F){this.checkContext();const D=this.getYForLine(0),G=this.getYForLine(this.options.num_lines-1);F&&this.context.fillRect(R-3,D,1,G-D+1),this.context.fillRect(R,D,1,G-D+1)}drawVerticalBar(R){this.drawVerticalBarFixed(this.x+R,!1)}drawVerticalBarFixed(R){this.checkContext();const F=this.getYForLine(0),D=this.getYForLine(this.options.num_lines-1);this.context.fillRect(R,F,1,D-F+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(R,F){if(R>=this.options.num_lines||R<0)throw new Vex.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(F.visible===void 0)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof F.visible!="boolean")throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[R]=F,this}setConfigForLines(R){if(R.length!==this.options.num_lines)throw new Vex.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const F in R)R[F]||(R[F]=this.options.line_config[F]),Vex.Merge(this.options.line_config[F],R[F]);return this.options.line_config=R,this}}class TabStave extends Stave{constructor(R,F,D,G){const U={spacing_between_lines_px:13,num_lines:6,top_text_position:1};Vex.Merge(U,G),super(R,F,D,U),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function getUnusedStringGroups(B,R){const F=[];let D=[];for(let G=1;G<=B;G++)R.indexOf(G)>-1?(F.push(D),D=[]):D.push(G);return D.length>0&&F.push(D),F}function getPartialStemLines(B,R,F,D){const G=D!==1,U=D!==-1,W=F.getSpacingBetweenLines(),q=F.getNumLines(),Y=[];return R.forEach(K=>{const Z=K.indexOf(q)>-1,j=K.indexOf(1)>-1;if(G&&j||U&&Z)return;K.length===1&&K.push(K[0]);const Q=[];K.forEach((J,te,ne)=>{const ie=J===1,re=J===q;let oe=F.getYForLine(J-1);te===0&&!ie?oe-=W/2-1:te===ne.length-1&&!re&&(oe+=W/2-1),Q.push(oe),D===1&&ie?Q.push(B-2):D===-1&&re&&Q.push(B+2)}),Y.push(Q.sort((J,te)=>J-te))}),Y}class TabNote$1 extends StemmableNote{static get CATEGORY(){return"tabnotes"}constructor(R,F){if(super(R),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=R.positions,Vex.Merge(this.render_options,{glyph_font_scale:Flow.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:F,draw_dots:F,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(R)}`);this.buildStem(),R.stem_direction?this.setStemDirection(R.stem_direction):this.setStemDirection(Stem.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return TabNote$1.CATEGORY}setGhost(R){return this.ghost=R,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const R=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:R?this.getStemDirection()===1?R.tabnote_stem_up_extension:R.tabnote_stem_down_extension:0}addDot(){const R=new Dot;return this.dots+=1,this.addModifier(R,0)}updateWidth(){this.glyphs=[],this.width=0;for(let R=0;Rthis.width}setStave(R){super.setStave(R),this.context=R.context;let F;if(this.context){const G=this.context;for(this.width=0,F=0;FU.width),this.width=Math.max(U.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const D=this.positions.map(({str:G})=>R.getYForLine(G-1));return this.setYs(D),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(R){this.setModifierContext(R);for(let F=0;F{R.getCategory()==="dots"&&!this.render_options.draw_dots||(R.setContext(this.context),R.drawWithStyle())})}drawStemThrough(){const R=this.getStemX(),F=this.getStemY(),D=this.context,G=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&G){const W=this.stave.getNumLines(),q=this.positions.map(Z=>Z.str),Y=getUnusedStringGroups(W,q),K=getPartialStemLines(F,Y,this.getStave(),this.getStemDirection());D.save(),D.setLineWidth(Stem.WIDTH),K.forEach(Z=>{Z.length!==0&&(D.beginPath(),D.moveTo(R,Z[0]),D.lineTo(R,Z[Z.length-1]),D.stroke(),D.closePath())}),D.restore()}}drawPositions(){const R=this.context,F=this.getAbsoluteX(),D=this.ys;for(let G=0;GparseInt(G,10)?TabSlide.SLIDE_DOWN:TabSlide.SLIDE_UP}this.slide_direction=F,this.render_options.cp1=11,this.render_options.cp2=14,this.render_options.y_shift=.5,this.setFont({font:"Times",size:10,style:"bold italic"}),this.setNotes(R)}renderTie(R){if(R.first_ys.length===0||R.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const F=this.context,D=R.first_x_px,G=R.first_ys,U=R.last_x_px,W=this.slide_direction;if(W!==TabSlide.SLIDE_UP&&W!==TabSlide.SLIDE_DOWN)throw new Vex.RERR("BadSlide","Invalid slide direction");for(let q=0;qthis.numStrings)throw new Vex.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${R}`);return this.tuningValues[F-1]}getValueForFret(R,F){const D=this.getValueForString(F),G=parseInt(R,10);if(G<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+R);return D+G}getNoteForFret(R,F){const D=this.getValueForFret(R,F),G=Math.floor(D/12),U=D%12;return Flow.integerToNote(U)+"/"+G}}class KeyManager{constructor(R){this.music=new Music,this.setKey(R)}setKey(R){return this.key=R,this.reset(),this}getKey(){return this.key}reset(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!Music.scaleTypes[this.keyParts.type])throw new Vex.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Music.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const F=Music.root_indices[this.keyParts.root];for(let D=0;D{const D=TextDynamics.GLYPHS[F];if(!D)throw new Vex.RERR("Invalid dynamics character: "+F);const G=this.render_options.glyph_font_size,U=new Glyph(D.code,G);this.glyphs.push(U),R+=D.width}),this.setWidth(R),this.preFormatted=!0,this}draw(){this.setRendered();const R=this.getAbsoluteX(),F=this.stave.getYForLine(this.line+-3);L$8("Rendering Dynamics: ",this.sequence);let D=R;this.glyphs.forEach((G,U)=>{const W=this.sequence[U];G.render(this.context,D,F),D+=TextDynamics.GLYPHS[W].width})}}function drawArrowHead(B,R,F,D,G,U,W){B.beginPath(),B.moveTo(R,F),B.lineTo(D,G),B.lineTo(U,W),B.lineTo(R,F),B.closePath(),B.fill()}function drawArrowLine(B,R,F,D){const G=D.draw_start_arrow&&D.draw_end_arrow,U=R.x,W=R.y,q=F.x,Y=F.y,K=Math.sqrt((q-U)*(q-U)+(Y-W)*(Y-W)),Z=(K-D.arrowhead_length/3)/K;let j,Q,J,te;D.draw_end_arrow||G?(j=Math.round(U+(q-U)*Z),Q=Math.round(W+(Y-W)*Z)):(j=q,Q=Y),D.draw_start_arrow||G?(J=U+(q-U)*(1-Z),te=W+(Y-W)*(1-Z)):(J=U,te=W),D.color&&(B.setStrokeStyle(D.color),B.setFillStyle(D.color)),B.beginPath(),B.moveTo(J,te),B.lineTo(j,Q),B.stroke(),B.closePath();const ne=Math.atan2(Y-W,q-U),ie=Math.abs(D.arrowhead_length/Math.cos(D.arrowhead_angle));let re,oe,le,fe,he,ge;(D.draw_end_arrow||G)&&(re=ne+Math.PI+D.arrowhead_angle,le=q+Math.cos(re)*ie,fe=Y+Math.sin(re)*ie,oe=ne+Math.PI-D.arrowhead_angle,he=q+Math.cos(oe)*ie,ge=Y+Math.sin(oe)*ie,drawArrowHead(B,le,fe,q,Y,he,ge)),(D.draw_start_arrow||G)&&(re=ne+D.arrowhead_angle,le=U+Math.cos(re)*ie,fe=W+Math.sin(re)*ie,oe=ne-D.arrowhead_angle,he=U+Math.cos(oe)*ie,ge=W+Math.sin(oe)*ie,drawArrowHead(B,le,fe,U,W,he,ge))}class StaveLine extends Element$2{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(R){super(),this.setAttribute("type","StaveLine"),this.notes=R,this.text="",this.font={family:"Arial",size:10,weight:""},this.render_options={padding_left:4,padding_right:3,line_width:1,line_dash:null,rounded_end:!0,color:null,draw_start_arrow:!1,draw_end_arrow:!1,arrowhead_length:10,arrowhead_angle:Math.PI/8,text_position_vertical:StaveLine.TextVerticalPosition.TOP,text_justification:StaveLine.TextJustification.CENTER},this.setNotes(R)}setFont(R){return this.font=R,this}setText(R){return this.text=R,this}setNotes(R){if(!R.first_note&&!R.last_note)throw new Vex.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(R.first_indices||(R.first_indices=[0]),R.last_indices||(R.last_indices=[0]),R.first_indices.length!==R.last_indices.length)throw new Vex.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=R.first_note,this.first_indices=R.first_indices,this.last_note=R.last_note,this.last_indices=R.last_indices,this}applyLineStyle(){const R=this.checkContext(),F=this.render_options;F.line_dash&&R.setLineDash(F.line_dash),F.line_width&&R.setLineWidth(F.line_width),F.rounded_end?R.setLineCap("round"):R.setLineCap("square")}applyFontStyle(){const R=this.checkContext();this.font&&R.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(R.setStrokeStyle(this.render_options.color),R.setFillStyle(this.render_options.color))}draw(){const R=this.checkContext();this.setRendered();const F=this.first_note,D=this.last_note,G=this.render_options;R.save(),this.applyLineStyle();let U,W;this.first_indices.forEach((Q,J)=>{const te=this.last_indices[J];U=F.getModifierStartXY(2,Q),W=D.getModifierStartXY(1,te);const ne=U.y>W.y;U.x+=F.getMetrics().modRightPx+G.padding_left,W.x-=D.getMetrics().modLeftPx+G.padding_right;const ie=F.getGlyph().getWidth();F.getKeyProps()[Q].displaced&&F.getStemDirection()===1&&(U.x+=ie+G.padding_left),D.getKeyProps()[te].displaced&&D.getStemDirection()===-1&&(W.x-=ie+G.padding_right),U.y+=ne?-3:1,W.y+=ne?2:0,drawArrowLine(R,U,W,this.render_options)}),R.restore();const q=R.measureText(this.text).width,Y=G.text_justification;let K=0;Y===StaveLine.TextJustification.LEFT?K=U.x:Y===StaveLine.TextJustification.CENTER?K=(W.x-U.x)/2+U.x-q/2:Y===StaveLine.TextJustification.RIGHT&&(K=W.x-q);let Z;const j=G.text_position_vertical;return j===StaveLine.TextVerticalPosition.TOP?Z=F.getStave().getYForTopText():j===StaveLine.TextVerticalPosition.BOTTOM&&(Z=F.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),R.save(),this.applyFontStyle(),R.fillText(this.text,K,Z),R.restore(),this}}function L$7(...B){PedalMarking.DEBUG&&Vex.L("Vex.Flow.PedalMarking",B)}function drawPedalGlyph(B,R,F,D,G){const U=PedalMarking.GLYPHS[B];new Glyph(U.code,G).render(R,F+U.x_shift,D+U.y_shift)}class PedalMarking extends Element$2{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}static get StylesString(){return{text:PedalMarking.Styles.TEXT,bracket:PedalMarking.Styles.BRACKET,mixed:PedalMarking.Styles.MIXED,mixed_open_end:PedalMarking.Styles.MIXED_OPEN_END,bracket_open_begin:PedalMarking.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:PedalMarking.Styles.BRACKET_OPEN_END,bracket_open_both:PedalMarking.Styles.BRACKET_OPEN_BOTH}}static createSustain(R){return new PedalMarking(R)}static createSostenuto(R){const F=new PedalMarking(R);return F.setStyle(PedalMarking.Styles.MIXED),F.setCustomText("Sost. Ped."),F}static createUnaCorda(R){const F=new PedalMarking(R);return F.setStyle(PedalMarking.Styles.TEXT),F.setCustomText("una corda","tre corda"),F}constructor(R){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=R,this.style=PedalMarking.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setEndStave(R){if(this.endStave=R,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let F=0;F3)throw new Vex.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=R,this}setLine(R){return this.line=R,this}drawBracketed(){const R=this.context;let F=!1,D,G;const U=this;this.notes.forEach((W,q,Y)=>{F=!F;let K=0;if(W?K=W.getNoteHeadBeginX():K=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)F?this.ChangeBegin&&(K=W.getAbsoluteX()):(W?this.ChangeEnd?K=W.getAbsoluteX():K=W.getStave().end_x+this.endStaveAddedWidth-U.render_options.text_margin_right:K=this.endStave.end_x+this.endStaveAddedWidth-U.render_options.text_margin_right,this.endMargin=-U.render_options.text_margin_right);else if(W)if(F)this.ChangeBegin&&(K=W.getAbsoluteX());else switch(U.style){case PedalMarking.Styles.BRACKET_OPEN_END:case PedalMarking.Styles.BRACKET_OPEN_BOTH:case PedalMarking.Styles.MIXED_OPEN_END:K=W.getNoteHeadEndX();break;default:this.ChangeEnd?K=W.getAbsoluteX():(K=W.getNoteHeadBeginX()-U.render_options.text_margin_right,this.startMargin=-U.render_options.text_margin_right);break}let Z=this.endStave;W&&(Z=W.getStave());let j=Z.getYForBottomText(U.line+3);G&&G>j&&(j=G);const Q=Y[q+1]===W,J=Y[q-1]===W;let te=0;if(F)if(te=J?5:0,(U.style===PedalMarking.Styles.MIXED||U.style===PedalMarking.Styles.MIXED_OPEN_END)&&!J)if(U.custom_depress_text){const ne=R.measureText(U.custom_depress_text).width;R.fillText(U.custom_depress_text,K-ne/2,j),te=ne/2+U.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",R,K,j,U.render_options.glyph_point_size),te=20+U.render_options.text_margin_right;else R.beginPath(),U.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||U.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?R.moveTo(K+te,j):(this.ChangeBegin&&(K+=5),R.moveTo(K,j-U.render_options.bracket_height),this.ChangeBegin&&(K+=5),R.lineTo(K+te,j)),R.stroke(),R.closePath();else te=Q&&!this.EndsStave?-5:0,R.beginPath(),R.moveTo(D,G),R.lineTo(K+te,j),U.style!==PedalMarking.Styles.BRACKET_OPEN_END&&U.style!==PedalMarking.Styles.MIXED_OPEN_END&&U.style!==PedalMarking.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(K+=5),R.lineTo(K,j-U.render_options.bracket_height)),R.stroke(),R.closePath();D=K+te,G=j})}drawText(){const R=this.context;let F=!1;const D=this,G=D.render_options.glyph_point_size;this.notes.forEach(U=>{F=!F;const W=U.getStave(),q=U.getAbsoluteX(),Y=W.getYForBottomText(D.line+3);let K=0;F?D.custom_depress_text?(K=R.measureText(D.custom_depress_text).width,R.fillText(D.custom_depress_text,q-K/2,Y)):drawPedalGlyph("pedal_depress",R,q,Y,G):D.custom_release_text?(K=R.measureText(D.custom_release_text).width,R.fillText(D.custom_release_text,q-K/2,Y)):drawPedalGlyph("pedal_release",R,q,Y,G)})}draw(){const R=this.checkContext();this.setRendered(),R.save(),R.setStrokeStyle(this.render_options.color),R.setFillStyle(this.render_options.color),R.setFont(this.font.family,this.font.size,this.font.weight),L$7("Rendering Pedal Marking"),this.style===PedalMarking.Styles.BRACKET||this.style===PedalMarking.Styles.MIXED||this.style===PedalMarking.Styles.MIXED_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||this.style===PedalMarking.Styles.BRACKET_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?(R.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===PedalMarking.Styles.TEXT&&this.drawText(),R.restore()}}function L$6(...B){TextBracket.DEBUG&&Vex.L("Vex.Flow.TextBracket",B)}class TextBracket extends Element$2{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:TextBracket.Positions.TOP,bottom:TextBracket.Positions.BOTTOM}}constructor({start:R,stop:F,text:D="",superscript:G="",position:U=TextBracket.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=R,this.stop=F,this.text=D,this.superscript=G,this.position=typeof U=="string"?TextBracket.PositionString[U]:U,this.line=1,this.font={family:"Serif",size:15,weight:"italic"},this.render_options={dashed:!0,dash:[5],color:"black",line_width:1,show_bracket:!0,bracket_height:8,underline_superscript:!0}}applyStyle(R){return R.setFont(this.font.family,this.font.size,this.font.weight),R.setStrokeStyle(this.render_options.color),R.setFillStyle(this.render_options.color),R.setLineWidth(this.render_options.line_width),this}setDashed(R,F){return this.render_options.dashed=R,F&&(this.render_options.dash=F),this}setFont(R){return this.font={...this.font,...R},this}setLine(R){return this.line=R,this}draw(){const R=this.context;this.setRendered();let F=0;switch(this.position){case TextBracket.Positions.TOP:F=this.start.getStave().getYForTopText(this.line);break;case TextBracket.Positions.BOTTOM:F=this.start.getStave().getYForBottomText(this.line+Flow.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const D={x:this.start.getAbsoluteX(),y:F},G={x:this.stop.getAbsoluteX(),y:F};L$6("Rendering TextBracket: start:",D,"stop:",G,"y:",F);const U=this.render_options.bracket_height*this.position;R.save(),this.applyStyle(R),R.fillText(this.text,D.x,D.y);const W=R.measureText(this.text).width,q=R.measureText("M").width,Y=D.y-q/2.5;R.setFont(this.font.family,this.font.size/1.4,this.font.weight),R.fillText(this.superscript,D.x+W+1,Y);const K=R.measureText(this.superscript).width,Z=R.measureText("M").width;let j=D.x,Q=Y;const J=G.x+this.stop.getGlyph().getWidth();this.position===TextBracket.Positions.TOP?(j+=W+K+5,Q-=Z/2.7):this.position===TextBracket.Positions.BOTTOM&&(Q+=Z/2.7,j+=W+2,this.render_options.underline_superscript||(j+=K)),this.render_options.dashed?(Renderer.drawDashedLine(R,j,Q,J,Q,this.render_options.dash),this.render_options.show_bracket&&Renderer.drawDashedLine(R,J,Q+1*this.position,J,Q+U,this.render_options.dash)):(R.beginPath(),R.moveTo(j,Q),R.lineTo(J,Q),this.render_options.show_bracket&&R.lineTo(J,Q+U),R.stroke(),R.closePath()),R.restore()}}function L$5(...B){BarNote.DEBUG&&Vex.L("Vex.Flow.BarNote",B)}class BarNote extends Note{constructor(R=Barline.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const F=Barline.type;this.metrics.widths={[F.SINGLE]:8,[F.DOUBLE]:12,[F.END]:15,[F.REPEAT_BEGIN]:14,[F.REPEAT_END]:14,[F.REPEAT_BOTH]:18,[F.NONE]:0},this.ignore_ticks=!0,this.setType(R)}getType(){return this.type}setType(R){return this.type=typeof R=="string"?Barline.typeString[R]:R,this.setWidth(this.metrics.widths[this.type]),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");L$5("Rendering bar line at: ",this.getAbsoluteX());const R=new Barline(this.type);R.setX(this.getAbsoluteX()),R.draw(this.stave),this.setRendered()}}class GhostNote extends StemmableNote{constructor(R){if(!R)throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let F;if(typeof R=="string")F={duration:R};else if(typeof R=="object")F=R;else throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(F),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(R){super.setStave(R)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let R=0;R0||F===!0;return F&&!(U>0)&&(this.pos=G),q?this.matchSuccess():this.matchFail(G),{success:q,results:D,numMatches:U}}expectZeroOrMore(R){return this.expectOneOrMore(R,!0)}expect(R){L$3("Evaluating rules:",R);let F;if(!R)throw new X$2("Invalid Rule: "+R,R);const D=R.bind(this.grammar)();if(D.token)F=this.matchToken(D.token,D.noSpace===!0),F.success&&(this.pos+=F.incrementPos);else if(D.expect)D.oneOrMore?F=this.expectOneOrMore(D):D.zeroOrMore?F=this.expectZeroOrMore(D):F=this.expectOne(D);else throw new X$2("Bad grammar! No `token` or `expect` property",D);return F.matches=[],F.results&&F.results.forEach(G=>F.matches.push(flattenMatches(G))),D.run&&F.success&&D.run(F),F}}function L$2(...B){EasyScore.DEBUG&&Vex.L("Vex.Flow.EasyScore",B)}const X$1=Vex.MakeException("EasyScoreError");class Grammar{constructor(R){this.builder=R}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:()=>this.builder.commitPiece()}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:R=>this.builder.addChord(R.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:R=>this.builder.addSingleNote(R.matches[0],R.matches[1],R.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:R=>this.builder.setNoteDots(R.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:R=>this.builder.setNoteType(R.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:R=>this.builder.setNoteDuration(R.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){const R=F=>F.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:F=>this.builder.addNoteOption(F.matches[0],R(F.matches[2]))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bbs|bb|bss|bs|b|db|d|##|#|n|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSxX]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}}class Builder{constructor(R){this.factory=R,this.commitHooks=[],this.reset()}reset(R={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,R)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(R){this.commitHooks.push(R)}resetPiece(){L$2("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(R){L$2("setNoteDots:",R),R&&(this.piece.dots=R.length)}setNoteDuration(R){L$2("setNoteDuration:",R),this.rollingDuration=this.piece.duration=R||this.rollingDuration}setNoteType(R){L$2("setNoteType:",R),R&&(this.piece.type=R)}addNoteOption(R,F){L$2("addNoteOption: key:",R,"value:",F),this.piece.options[R]=F}addNote(R,F,D){L$2("addNote:",R,F,D),this.piece.chord.push({key:R,accid:F,octave:D})}addSingleNote(R,F,D){L$2("addSingleNote:",R,F,D),this.addNote(R,F,D)}addChord(R){L$2("startChord"),typeof R[0]!="object"?this.addSingleNote(R[0]):R.forEach(F=>{F&&this.addNote(...F)}),L$2("endChord")}commitPiece(){L$2("commitPiece");const{factory:R}=this;if(!R)return;const F={...this.options,...this.piece.options},{stem:D,clef:G}=F,U=D.toLowerCase()==="auto",W=!U&&D.toLowerCase()==="up"?StaveNote.STEM_UP:StaveNote.STEM_DOWN,{chord:q,duration:Y,dots:K,type:Z}=this.piece,j=q.map(te=>te.key+"/"+te.octave),Q=R.StaveNote({keys:j,duration:Y,dots:K,type:Z,clef:G,auto_stem:U});U||Q.setStemDirection(W);const J=q.map(te=>te.accid||null);J.forEach((te,ne)=>{te&&Q.addAccidental(ne,R.Accidental({type:te}))});for(let te=0;tete(F,Q,this)),this.elements.notes.push(Q),this.elements.accidentals.concat(J),this.resetPiece()}}function setId({id:B},R){B!==void 0&&R.setAttribute("id",B)}function setClass(B,R){if(!B.class)return;const F=/\s*,\s*/;B.class.split(F).forEach(D=>R.addClass(D))}class EasyScore{constructor(R={}){this.setOptions(R),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(R){return Object.assign(this.defaults,R),this}setOptions(R){return this.options={factory:null,builder:null,commitHooks:[setId,setClass,Articulation$1.easyScoreHook],throwOnError:!1,...R},this.factory=this.options.factory,this.builder=this.options.builder||new Builder(this.factory),this.grammar=new Grammar(this.builder),this.parser=new Parser$1(this.grammar),this.options.commitHooks.forEach(F=>this.addCommitHook(F)),this}setContext(R){return this.factory&&this.factory.setContext(R),this}parse(R,F={}){this.builder.reset(F);const D=this.parser.parse(R);if(!D.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+R,D);return D}beam(R,F={}){return this.factory.Beam({notes:R,options:F}),R}tuplet(R,F={}){return this.factory.Tuplet({notes:R,options:F}),R}notes(R,F={}){return F={clef:this.defaults.clef,stem:this.defaults.stem,...F},this.parse(R,F),this.builder.getElements().notes}voice(R,F){return F={time:this.defaults.time,...F},this.factory.Voice(F).addTickables(R)}addCommitHook(R){return this.builder.addCommitHook(R)}}function initGroup(){return{notes:[],finish:!1,total:0,staveId:""}}let _text_width=null,tone="C",group$1=initGroup(),_denominator="",_numerator="",ornamentGroup="";class NumberedNote extends StaveNote{static get CATEGORY(){return"numberednotes"}static accidentalAndKey(R){switch(R){case"G":return{4:"#"};case"D":return{1:"#",4:"#"};case"A":return{1:"#",4:"#",5:"#"};case"E":return{1:"#",2:"#",4:"#",5:"#"};case"B":return{1:"#",2:"#",4:"#",5:"#",6:"#"};case"F#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#"};case"C#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#",7:"#"};case"F":return{7:"b"};case"Bb":return{7:"b",3:"b"};case"Eb":return{7:"b",3:"b",6:"b"};case"Ab":return{7:"b",2:"b",3:"b",6:"b"};case"Db":return{7:"b",2:"b",3:"b",5:"b",6:"b"};case"Gb":return{7:"b",1:"b",2:"b",3:"b",5:"b",6:"b"};case"Cb":return{7:"b",1:"b",2:"b",3:"b",4:"b",5:"b",6:"b"};default:return{}}}static accidentalMap(R){switch(R){case"C":return"";case"F":case"Bb":case"Eb":case"Ab":case"Db":case"Gb":case"Cb":return{bb:"b",b:"",n:"#","#":"##"};default:return{b:"bb",n:"b","#":"","##":"#"}}}static get noteLift(){switch(tone){case"G":return["7"];case"D":return["7","3"];case"A":return["7","3","6"];case"E":return["2","6","3","7"];case"B":return["5","2","6","3","7"];case"F#":return["1","5","2","6","3","7"];case"C#":return["4","1","5","2","6","3","7"];case"F":return["4"];case"Bb":return["1","4"];case"Eb":return["5","1","4"];case"Ab":return["2","5","1","4"];case"Db":return["6","2","5","1","4"];case"Gb":return["3","6","2","5","1","4"];case"Cb":return["7","3","6","2","5","1","4"]}}static get longDurationLine(){return{1:3,2:1,6:2}}static get numberedDurationLine(){return{8:1,16:2,32:3,64:4,128:5}}static get durationTime(){return{8:6144,4:4096}}constructor(R){super(R),this.setAttribute("type","NumberedNote"),tone=R.keyString,this.ornament=!!R.ornament,this.line=0,this.keys=R.keys||[],this.fontSize=20,this.offset_x=0,this.offset_y=0,this.note_tones=[],this.duration_lines=0,this.long_duration_lines=0,this.note_size=R.note_size||16;const F=Flow.sanitizeDuration(this.duration);var D=NumberedNote.numberedDurationLine[F.toString()];if(D&&(this.duration_lines=D),D=NumberedNote.longDurationLine[F.toString()],D&&(this.long_duration_lines=D),!_text_width){var G="__$text_wraper$$__";let W=document.createElement("canvas");W.id=G,document.body.append(W);const q=document.getElementById(G),Y=q.getContext("2d");Y.font="Arial 22px";var U=Y.measureText("5");_text_width=U.width+2,document.body.removeChild(q)}}getCategory(){return NumberedNote.CATEGORY}setKeySignature(R){this.keySignature=R}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setWidth(this.full_width),this.setPreFormatted(!0))}filterNote(){if(window&&window.sett&&window.sett.keySignature||!this.keys||!this.keys.length)return;const R=NumberedNote.accidentalMap(tone);if(!R)return;const F=NumberedNote.noteLift;if(!F)return;var D=this.keys[0].split("/"),G=D[0];G==="b"&&(G="R"),G=G.replaceAll("#",""),G=G.replaceAll("n",""),G.length>1&&(G=G.replaceAll("b",""));const U=NumberedNoteHead.numberedNotationMapping[G.toUpperCase()];if(F.includes(U))for(let W=0;W{switch(D.getAttribute("type")){case"Accidental":D.render_options.font_scale=this.note_width*1.4,D.x_shift=2,D.y_shift=this.unit_height/2,this.ornament&&(D.render_options.font_scale=this.note_width,D.x_shift=14,D.y_shift=-10);break;case"Stroke":D.x_shift=-1*R,D.y_shift=1*this.unit_height;break;case"Dot":D.x_shift=F*this.duration_dot_width+7,D.y_shift=1*this.unit_height,F++;break;case"Ornament":D.y_shift=-3;break;default:D.y_shift=1*this.unit_height}D.reset&&D.reset(),R+=D.getWidth()/2})}handleDeleteDot(){for(let R=0;RW),D=F.length?F[0]/F[1]:0;if(this.ornament)return;if(D===0)return this.long_duration_lines=this.intrinsicTicks/R-1,this.long_duration_lines>=_numerator&&(this.long_duration_lines=_numerator-1),_denominator==8&&(this.long_duration_lines=0,_numerator==3&&this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),_numerator==6&&(this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),new Glyph("v0",40).render(this.context,this.bottom_x+40,this.top_y),this.draw_dot(this.context,this.bottom_x+65,this.bottom_y-30,this.dot_width))),group$1=initGroup();let G={lines:this.duration_lines,duration:D,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};D>R*2&&(this.long_duration_lines=parseInt(D/R)-1,this.handleDeleteDot()),ornamentGroup&&(G.x+=this.note_width),group$1.notes.push(G);let U=group$1.notes.reduce((W,q)=>W+q.duration,0);U=parseInt(U),U>R&&(U-=R),U>R-10&&Uq.lines===0).length&&(this.drawDurationLoneLine(),group$1=initGroup()))}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");let R=this.context;R.save(),R.setFont("Arial",this.note_height,"normal"),this.setAttribute("el",R.openGroup("stavenote",this.getAttribute("id"))),R.openGroup("note",null,{pointerBBox:!0});let F=this.getAbsoluteX()+2.5;this.x=F;let D=this.stave.getYForLine(2)+this.note_height/2;this.y=D,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(G=>{G.draw(R)}),R.openGroup("modifier",null,{pointerBBox:!0}),this.drawModifiers(),R.closeGroup(),R.closeGroup(),R.closeGroup(),this.calcGroup(),group$1.staveId=this.stave.attrs.id,this.drawDurationLine(R,{}),this.drawLongDurationLines(R),this.restoreStyle(),this.setRendered(),this.ornament?ornamentGroup?ornamentGroup=Object.assign(ornamentGroup,{lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}):ornamentGroup={lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}:ornamentGroup=""}drawDurationLoneLine(R,F){R=R||this.context;let D=F||this.y+this.duration_line_space;for(let G=0;G<5;G++){let U=[],W=0;for(let q=0;qG)U.push(Y),W++;else{if(U.length>1){let K=U.length-1;D=U[0].y+this.duration_line_space,R.rect(U[0].x,D+G*3,U[K].x-U[0].x+U[K].width,.5)}U=[],W=q+1}}if(U.length>1){let q=U.length-1;D=U[0].y+this.duration_line_space,R.rect(U[0].x,D+G*3,U[q].x-U[0].x+U[q].width,.5)}}}draw_dot(R,F,D,G){R.openGroup("numbered-note-dot"),R.beginPath(),R.arc(F,D,G,0,2*Math.PI),R.closePath(),R.fill(),R.closeGroup()}drawDurationLine(R,F){var D=this.attrs.id+"-lines";R.openGroup("numbered_note_lines",D);var G,U;if(this.duration_lines>0){const Y=this.duration_line_space;var W=this.full_width;if(F&&F.width&&(W=F.width),W<0&&(W=this.note_width),!F||typeof F.startX=="undefined"?G=this.x-Y/2-this.left_width:G=F.startX,!F||typeof F.startY=="undefined"?U=this.y+this.duration_line_space:U=F.startY,group$1.finish&&(this.drawDurationLoneLine(R,U),group$1=initGroup()),this.ornament?(G+=12,U-=22,W=15,ornamentGroup&&(G-=10,W+=10)):ornamentGroup&&(G+=this.note_width,W-=this.note_width),W>0){for(var q=0;qq.getAttribute("type")==="Accidental"),W=this.modifiers.findIndex(q=>q.getAttribute("type")==="Accidental");G&&W>-1?this.modifiers[W].accidental.code=G==="#"?"v18":"v44":this.modifiers.splice(W,1)}}catch(G){console.log("\u{1F680} ~ error",G)}}this.setYs(R)}getFullWidth(){return this.full_width}getFullHeight(){return this.full_height}getLine(){return this.keyProps[0].line}get full_width(){return this.note_width+this.left_width+this.right_width+this.long_duration_line_width}get long_duration_line_width(){return(this.long_duration_width+this.long_duration_space)*this.long_duration_lines}get full_height(){return this.bottom_y-this.top_y}get note_width(){return this.note_size||0}get note_dot_width(){return 6}get note_height(){return this.unit_height}get unit_height(){return this.note_size||0}get note_x(){return this.x||0}get top_x(){return this.x||0}get top_y(){var R=this;return(this.y||0)-(R.note_tones.map(D=>(D.td+D.bd)*(R.dot_space+R.dot_width)).reduce((D,G)=>D+G,0)+this.note_height*this.note_tones.length-this.unit_height-this.note_tones[0].bd*(R.dot_space+R.dot_width)+(this.note_tones.length-1)*this.head_space)}get bottom_x(){return this.x||0}get bottom_y(){return(this.y||0)+this.unit_height+this.duration_lines*(this.duration_line_height+this.duration_line_space)+this.note_tones[0].meta.bd*(this.dot_width+this.dot_space)}get left_width(){return this.modifiers_width}get right_width(){return this.full_duration_dot_width}get duration_dot_width(){return 6}get full_duration_dot_width(){return this.duration_dot_width*this.getModifiersByCategory(Dot.CATEGORY).length}getModifiersByCategory(R){var F=[];return this.modifiers.forEach(D=>{D.getCategory()===R&&F.push(D)}),F}get head_space(){return 6}get duration_line_height(){return 2}get duration_line_space(){return 4}get dot_width(){return 2}get dot_space(){return 2}get long_duration_space(){return 10}get long_duration_width(){return 20}getWidth(){return this.full_width}get modifiers_width(){let R=0;return this.modifiers.forEach(F=>{R+=F.getWidth()}),R}}class NumberedNoteHead{static get numberedNotationMapping(){let R=tone;switch(window&&window.sett&&window.sett.keySignature&&(R="C"),R){case"A":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:2.5,max:5.5};case"B":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"D":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"E":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"F":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"G":case"Gb":return{C:"4",D:"5",E:"6",F:"7",G:"1",A:"2",B:"3",R:"0",min:2,max:5};case"Eb":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"D#":case"Db":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"F#":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"Ab":case"G#":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:-1,max:2};case"Bb":case"A#":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"C#":case"Cb":default:return{C:"1",D:"2",E:"3",F:"4",G:"5",A:"6",B:"7",R:"0",min:0,max:3}}}tone_to_numbered_key(){var R=this.key.split("/"),F=R[0];F==="b"&&(F="R"),F=F.replaceAll("#",""),F=F.replaceAll("n",""),F.length>1&&(F=F.replaceAll("b",""));let D=0,G=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(tone=this.note.stave.options.keySignature);const U=this.note.getLine();return UNumberedNoteHead.numberedNotationMapping.max&&(G=Math.ceil((U-NumberedNoteHead.numberedNotationMapping.max)/3.5)),F.toUpperCase()==="R"&&(D=0,G=0),{key:NumberedNoteHead.numberedNotationMapping[F.toUpperCase()],td:G,bd:D}}constructor(R){this.key=R.key,this.x=R.x||0,this.y=R.y||0,this.idx=R.idx||0,this.note=R.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=R.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}draw(R){let F=this.y;R.openGroup("numbered-note-head");var D=this.x+(this.note.ornament?-2:0);let G=F-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let W=0;W1&&(q-=this.note.duration_line_space),F+=q}this.draw_dot(R,D+_text_width,F,this.note.dot_width),F+=this.note.dot_width+this.note.dot_space}R.closeGroup()}get height(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}draw_dot(R,F,D,G){R.openGroup("numbered-note-dot"),R.beginPath(),R.arc(F,D,G,0,2*Math.PI),R.closePath(),R.fill(),R.closeGroup()}}function L$1(...B){Factory.DEBUG&&Vex.L("Vex.Flow.Factory",B)}const X=Vex.MakeException("FactoryError");function setDefaults$1(B={},R){const F=R.options;return B=Object.assign(R,B),B.options=Object.assign(F,B.options),B}class Factory{constructor(R){L$1("New factory: ",R);const F={stave:{space:10},renderer:{context:null,elementId:"",backend:Renderer.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=F,this.setOptions(R)}static newFromElementId(R,F=500,D=200){return new Factory({renderer:{elementId:R,width:F,height:D}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(R){for(const F of["stave","renderer","font"])Object.assign(this.options[F],R[F]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:R,backend:F,width:D,height:G,background:U}=this.options.renderer;if(R==="")throw new X("HTML DOM element not set in Factory");this.context=Renderer.buildContext(R,F,D,G,U)}getContext(){return this.context}setContext(R){return this.context=R,this}getStave(){return this.stave}getVoices(){return this.voices}space(R){return this.options.stave.space*R}Stave(R){R=setDefaults$1(R,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const F=new Stave(R.x,R.y,R.width,R.options);return this.staves.push(F),F.setContext(this.context),this.stave=F,F}TabStave(R){R=setDefaults$1(R,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});const F=new TabStave(R.x,R.y,R.width,R.options);return this.staves.push(F),F.setContext(this.context),this.stave=F,F}StaveNote(R){const F=new StaveNote(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}GhostNote(R){const F=new GhostNote(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}TextNote(R){const F=new TextNote(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}NumberedNote(R){const F=new NumberedNote(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}BarNote(R){R=setDefaults$1(R,{type:"single",options:{}});const F=new BarNote(R.type);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}ClefNote(R){R=setDefaults$1(R,{type:"treble",options:{size:"default"}});const F=new ClefNote(R.type,R.options.size,R.options.annotation);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}TimeSigNote(R){R=setDefaults$1(R,{time:"4/4",options:{}});const F=new TimeSigNote(R.time);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}KeySigNote(R){const F=new KeySigNote(R.key,R.cancelKey,R.alterKey);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}TabNote(R){const F=new TabNote$1(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}GraceNote(R){const F=new GraceNote(R);return this.stave&&F.setStave(this.stave),F.setContext(this.context),F}GraceNoteGroup(R){const F=new GraceNoteGroup(R.notes,R.slur);return F.setContext(this.context),F}Accidental(R){R=setDefaults$1(R,{type:null,options:{}});const F=new Accidental(R.type);return F.setContext(this.context),F}Annotation(R){R=setDefaults$1(R,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const F=new Annotation(R.text);return F.setJustification(R.hJustify),F.setVerticalJustification(R.vJustify),F.setFont(R.fontFamily,R.fontSize,R.fontWeight),F.setContext(this.context),F}Articulation(R){R=setDefaults$1(R,{type:"a.",position:"above",options:{}});const F=new Articulation$1(R.type);return F.setPosition(R.position),F.setContext(this.context),F}TextDynamics(R){R=setDefaults$1(R,{text:"p",duration:"q",dots:0,line:0,options:{}});const F=new TextDynamics({text:R.text,line:R.line,duration:R.duration,dots:R.dots});return this.stave&&F.setStave(this.stave),F.setContext(this.context),this.renderQ.push(F),F}Fingering(R){R=setDefaults$1(R,{number:"0",position:"left",options:{}});const F=new FretHandFinger(R.number);return F.setPosition(R.position),F.setContext(this.context),F}StringNumber(R){R=setDefaults$1(R,{number:"0",position:"left",options:{}});const F=new StringNumber(R.number);return F.setPosition(R.position),F.setContext(this.context),F}TickContext(){return new TickContext().setContext(this.context)}ModifierContext(){return new ModifierContext}MultiMeasureRest(R){const F=new MultiMeasureRest(R.number_of_measures,R);return F.setContext(this.context),this.renderQ.push(F),F}Voice(R){R=setDefaults$1(R,{time:"4/4",options:{}});const F=new Voice$1(R.time);return this.voices.push(F),F}StaveConnector(R){R=setDefaults$1(R,{top_stave:null,bottom_stave:null,type:"double",options:{}});const F=new StaveConnector(R.top_stave,R.bottom_stave);return F.setType(R.type).setContext(this.context),this.renderQ.push(F),F}Formatter(){return new Formatter}Tuplet(R){R=setDefaults$1(R,{notes:[],options:{}});const F=new Tuplet$1(R.notes,R.options).setContext(this.context);return this.renderQ.push(F),F}Beam(R){R=setDefaults$1(R,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const F=new Beam$1(R.notes,R.options.autoStem).setContext(this.context);return F.breakSecondaryAt(R.options.secondaryBeamBreaks),this.renderQ.push(F),F}Curve(R){R=setDefaults$1(R,{from:null,to:null,options:{}});const F=new Curve(R.from,R.to,R.options).setContext(this.context);return this.renderQ.push(F),F}StaveTie(R){R=setDefaults$1(R,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const F=new StaveTie({first_note:R.from,last_note:R.to,first_indices:R.first_indices,last_indices:R.last_indices},R.text);return R.options.direction&&F.setDirection(R.options.direction),F.setContext(this.context),this.renderQ.push(F),F}StaveLine(R){R=setDefaults$1(R,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const F=new StaveLine({first_note:R.from,last_note:R.to,first_indices:R.first_indices,last_indices:R.last_indices});return R.options.text&&F.setText(R.options.text),R.options.font&&F.setFont(R.options.font),F.setContext(this.context),this.renderQ.push(F),F}VibratoBracket(R){R=setDefaults$1(R,{from:null,to:null,options:{harsh:!1}});const F=new VibratoBracket({start:R.from,stop:R.to});return R.options.line&&F.setLine(R.options.line),R.options.harsh&&F.setHarsh(R.options.harsh),F.setContext(this.context),this.renderQ.push(F),F}TextBracket(R){R=setDefaults$1(R,{from:null,to:null,text:"",options:{superscript:"",position:1}});const F=new TextBracket({start:R.from,stop:R.to,text:R.text,superscript:R.options.superscript,position:R.options.position});return R.options.line&&F.setLine(R.options.line),R.options.font&&F.setFont(R.options.font),F.setContext(this.context),this.renderQ.push(F),F}System(R={}){R.factory=this;const F=new System(R).setContext(this.context);return this.systems.push(F),F}EasyScore(R={}){return R.factory=this,new EasyScore(R)}PedalMarking(R={}){R=setDefaults$1(R,{notes:[],options:{style:"mixed"}});const F=new PedalMarking(R.notes);return F.setStyle(PedalMarking.StylesString[R.options.style]),F.setContext(this.context),this.renderQ.push(F),F}NoteSubGroup(R={}){R=setDefaults$1(R,{notes:[],options:{}});const F=new NoteSubGroup$1(R.notes);return F.setContext(this.context),F}draw(){this.systems.forEach(R=>R.setContext(this.context).format()),this.staves.forEach(R=>R.setContext(this.context).draw()),this.voices.forEach(R=>R.setContext(this.context).draw()),this.renderQ.forEach(R=>{R.isRendered()||R.setContext(this.context).draw()}),this.systems.forEach(R=>R.setContext(this.context).draw()),this.reset()}}function setDefaults(B,R){const F=R.options;return B=Object.assign(R,B),B.options=Object.assign(F,B.options),B}class System extends Element$2{constructor(R={}){super(),this.setAttribute("type","System"),this.setOptions(R),this.parts=[]}setOptions(R={}){this.options=setDefaults(R,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new Factory({renderer:{el:null}})}setContext(R){return super.setContext(R),this.factory.setContext(R),this}addConnector(R="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:R}),this.connector}addStave(R){return R=setDefaults(R,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),R.stave||(R.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:R.options})),R.voices.forEach(F=>F.setContext(this.context).setStave(R.stave).getTickables().forEach(D=>D.setStave(R.stave))),this.parts.push(R),R.stave}format(){const R=new Formatter;this.formatter=R;let F=this.options.y,D=0,G=[];const U=[];this.parts.forEach(q=>{F=F+q.stave.space(q.spaceAbove),q.stave.setY(F),R.joinVoices(q.voices),F=F+q.stave.space(q.spaceBelow),F=F+q.stave.space(this.options.spaceBetweenStaves),q.debugNoteMetrics&&(U.push({y:F,voice:q.voices[0]}),F+=15),G=G.concat(q.voices),D=Math.max(D,q.stave.getNoteStartX())}),this.parts.forEach(q=>q.stave.setNoteStartX(D));const W=this.options.width-(D-this.options.x)-Note.STAVEPADDING;R.format(G,W);for(let q=0;q{F.voice.getTickables().forEach(D=>Note.plotMetrics(R,D,F.y))})}}Vex.Flow=Flow;Vex.Flow.Element=Element$2;Vex.Flow.Fraction=Fraction;Vex.Flow.Renderer=Renderer;Vex.Flow.Formatter=Formatter;Vex.Flow.Music=Music;Vex.Flow.Glyph=Glyph;Vex.Flow.Stave=Stave;Vex.Flow.StaveNote=StaveNote;Vex.Flow.StaveModifier=StaveModifier;Vex.Flow.StaveTempo=StaveTempo;Vex.Flow.Voice=Voice$1;Vex.Flow.Accidental=Accidental;Vex.Flow.Beam=Beam$1;Vex.Flow.StaveTie=StaveTie;Vex.Flow.TabStave=TabStave;Vex.Flow.TabNote=TabNote$1;Vex.Flow.Bend=Bend;Vex.Flow.Vibrato=Vibrato;Vex.Flow.VibratoBracket=VibratoBracket;Vex.Flow.Note=Note;Vex.Flow.ModifierContext=ModifierContext;Vex.Flow.MultiMeasureRest=MultiMeasureRest;Vex.Flow.TickContext=TickContext;Vex.Flow.Articulation=Articulation$1;Vex.Flow.Annotation=Annotation;Vex.Flow.Barline=Barline;Vex.Flow.NoteHead=NoteHead;Vex.Flow.StaveConnector=StaveConnector;Vex.Flow.ClefNote=ClefNote;Vex.Flow.KeySignature=KeySignature;Vex.Flow.KeySigNote=KeySigNote;Vex.Flow.TimeSignature=TimeSignature;Vex.Flow.TimeSigNote=TimeSigNote;Vex.Flow.Stem=Stem;Vex.Flow.TabTie=TabTie;Vex.Flow.Clef=Clef;Vex.Flow.Dot=Dot;Vex.Flow.Modifier=Modifier;Vex.Flow.TabSlide=TabSlide;Vex.Flow.Tuplet=Tuplet$1;Vex.Flow.GraceNote=GraceNote;Vex.Flow.GraceTabNote=GraceTabNote;Vex.Flow.Tuning=Tuning;Vex.Flow.KeyManager=KeyManager;Vex.Flow.StaveHairpin=StaveHairpin;Vex.Flow.BoundingBox=BoundingBox$1;Vex.Flow.Stroke=Stroke;Vex.Flow.TextNote=TextNote;Vex.Flow.Curve=Curve;Vex.Flow.TextDynamics=TextDynamics;Vex.Flow.StaveLine=StaveLine;Vex.Flow.Ornament=Ornament;Vex.Flow.PedalMarking=PedalMarking;Vex.Flow.TextBracket=TextBracket;Vex.Flow.FretHandFinger=FretHandFinger;Vex.Flow.Repetition=Repetition$1;Vex.Flow.BarNote=BarNote;Vex.Flow.GhostNote=GhostNote;Vex.Flow.NoteSubGroup=NoteSubGroup$1;Vex.Flow.GraceNoteGroup=GraceNoteGroup;Vex.Flow.Tremolo=Tremolo;Vex.Flow.StringNumber=StringNumber;Vex.Flow.Crescendo=Crescendo;Vex.Flow.Volta=Volta;Vex.Flow.Font=Font$1;Vex.Flow.System=System;Vex.Flow.Factory=Factory;Vex.Flow.Parser=Parser$1;Vex.Flow.EasyScore=EasyScore;Vex.Flow.Registry=Registry;var SystemLinesEnum=(B=>(B[B.SingleThin=0]="SingleThin",B[B.DoubleThin=1]="DoubleThin",B[B.ThinBold=2]="ThinBold",B[B.BoldThinDots=3]="BoldThinDots",B[B.DotsThinBold=4]="DotsThinBold",B[B.DotsBoldBoldDots=5]="DotsBoldBoldDots",B[B.None=6]="None",B[B.Dotted=7]="Dotted",B[B.Dashed=8]="Dashed",B[B.Bold=9]="Bold",B[B.BoldThin=10]="BoldThin",B[B.DoubleBold=11]="DoubleBold",B[B.Tick=12]="Tick",B[B.Short=13]="Short",B))(SystemLinesEnum||{});class SystemLinesEnumHelper{static xmlBarlineStyleToSystemLinesEnum(R){return R==="regular"?0:R==="dotted"?7:R==="dashed"?8:R==="heavy"?9:R==="light-light"?1:R==="light-heavy"?2:R==="heavy-light"?10:R==="heavy-heavy"?11:R==="tick"?12:R==="short"?13:R==="none"?6:0}}class Matrix2D{constructor(){this.matrix=[];for(let R=0;R<2;R++){this.matrix[R]=[];for(let F=0;F<2;F++)this.matrix[R][F]=0}}static getRotationMatrix(R){const F=new Matrix2D,D=Math.cos(R),G=Math.sin(R);return F.matrix[0][0]=D,F.matrix[0][1]=-G,F.matrix[1][0]=G,F.matrix[1][1]=D,F}scalarMultiplication(R){for(let F=0;F<2;F++)for(let D=0;D<2;D++)this.matrix[F][D]*=R}getTransposeMatrix(){const R=new Matrix2D;for(let F=0;F<2;F++)for(let D=0;D<2;D++)R.matrix[F][D]=this.matrix[D][F];return R}vectorMultiplication(R){const F=new PointF2D;return F.x=R.x*this.matrix[0][0]+R.y*this.matrix[0][1],F.y=R.x*this.matrix[1][0]+R.y*this.matrix[1][1],F}}class MusicSheetErrors{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(R){let F=this.measureErrors[R];F||(F=[]),this.measureErrors[R]=F.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(R){this.tempErrors.push(R)}push(R){this.errors.push(R)}}class Arpeggio{constructor(R,F=ArpeggioType.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=R,this.type=F,this.notes=[]}addNote(R){this.notes.push(R),R.Arpeggio=this}}var ArpeggioType=(B=>(B[B.BRUSH_DOWN=1]="BRUSH_DOWN",B[B.BRUSH_UP=2]="BRUSH_UP",B[B.ROLL_DOWN=3]="ROLL_DOWN",B[B.ROLL_UP=4]="ROLL_UP",B[B.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",B[B.RASQUEDO_UP=6]="RASQUEDO_UP",B[B.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",B))(ArpeggioType||{});class Beam{constructor(R=1,F=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=R,this.BeamNumberOffsetToXML=F}get Notes(){return this.notes}set Notes(R){this.notes=R}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(R){this.extendedNoteList=R}addNoteToBeam(R){R&&(R.NoteBeam=this,this.notes.push(R),this.extendedNoteList.push(R))}}class Voice{constructor(R,F){this.voiceEntries=[],this.volume=1,this.parent=R,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=F,this.uniqueVoiceId="I:"+this.parent.Id+" V: "+this.voiceId}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(R){this.visible=R}get Audible(){return this.audible}set Audible(R){this.audible=R}get Following(){return this.following}set Following(R){this.following=R}get Solo(){return this.solo}set Solo(R){this.solo=R}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(R){this.volume=R}toString(){return this.uniqueVoiceId}}class LinkedVoice extends Voice{constructor(R,F,D){super(R,F),this.master=D}get Master(){return this.master}}class Notehead{constructor(R,F,D=void 0){this.sourceNote=R,this.setShapeFromXml(F,D)}setShapeFromXml(R,F=void 0){this.shape=Notehead.ShapeTypeXmlToShape(R);let D=F;D===void 0&&(this.sourceNote?D=this.sourceNote.Length.Denominator>2:(log$2.warn("notehead: sourceNote and filledXmlAttribute undefined."),D=!0)),this.filled=D}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(R){switch(R.toLowerCase()){case"normal":return NoteHeadShape.NORMAL;case"x":return NoteHeadShape.X;case"slash":return NoteHeadShape.SLASH;case"diamond":return NoteHeadShape.DIAMOND;case"square":return NoteHeadShape.SQUARE;case"la":return NoteHeadShape.SQUARE;case"do":case"triangle":return NoteHeadShape.TRIANGLE;case"rectangle":return NoteHeadShape.RECTANGLE;case"circle-x":return NoteHeadShape.CIRCLEX;default:return log$2.info("unsupported/unhandled xml notehead '"+R+"'. Using normal notehead."),NoteHeadShape.NORMAL}}}var NoteHeadShape=(B=>(B[B.CIRCLEX=0]="CIRCLEX",B[B.DIAMOND=1]="DIAMOND",B[B.NORMAL=2]="NORMAL",B[B.RECTANGLE=3]="RECTANGLE",B[B.SLASH=4]="SLASH",B[B.SQUARE=5]="SQUARE",B[B.TRIANGLE=6]="TRIANGLE",B[B.X=7]="X",B))(NoteHeadShape||{});class ITextTranslation{static translateText(R,F){if(!this.defaultTextTranslation)return F}}var NoteType=(B=>(B[B.UNDEFINED=0]="UNDEFINED",B[B._1024th=1]="_1024th",B[B._512th=2]="_512th",B[B._256th=3]="_256th",B[B._128th=4]="_128th",B[B._64th=5]="_64th",B[B._32nd=6]="_32nd",B[B._16th=7]="_16th",B[B.EIGTH=8]="EIGTH",B[B.QUARTER=9]="QUARTER",B[B.HALF=10]="HALF",B[B.WHOLE=11]="WHOLE",B[B.BREVE=12]="BREVE",B[B.LONG=13]="LONG",B[B.MAXIMA=14]="MAXIMA",B))(NoteType||{});class NoteTypeHandler{static NoteTypeToString(R){return this.NoteTypeXmlValues[R]}static StringToNoteType(R){const F=this.NoteTypeXmlValues.indexOf(R);return F!==-1?F:0}static getNoteDurationFromType(R){switch(R){case"1024th":return new Fraction$1(1,1024);case"512th":return new Fraction$1(1,512);case"256th":return new Fraction$1(1,256);case"128th":return new Fraction$1(1,128);case"64th":return new Fraction$1(1,64);case"32th":case"32nd":return new Fraction$1(1,32);case"16th":return new Fraction$1(1,16);case"eighth":return new Fraction$1(1,8);case"quarter":return new Fraction$1(1,4);case"half":return new Fraction$1(1,2);case"whole":return new Fraction$1(1,1);case"breve":return new Fraction$1(2,1);case"long":return new Fraction$1(4,1);case"maxima":return new Fraction$1(8,1);default:{const F=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(F)}}}}NoteTypeHandler.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];class OrnamentContainer{constructor(R){this.placement=PlacementEnum.Above,this.accidentalAbove=AccidentalEnum.NONE,this.accidentalBelow=AccidentalEnum.NONE,this.ornament=R}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(R){this.accidentalAbove=R}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(R){this.accidentalBelow=R}}var OrnamentEnum=(B=>(B[B.Trill=0]="Trill",B[B.Turn=1]="Turn",B[B.InvertedTurn=2]="InvertedTurn",B[B.DelayedTurn=3]="DelayedTurn",B[B.DelayedInvertedTurn=4]="DelayedInvertedTurn",B[B.Mordent=5]="Mordent",B[B.InvertedMordent=6]="InvertedMordent",B))(OrnamentEnum||{});class VerticalSourceStaffEntryContainer{constructor(R,F,D){this.staffEntries=[],this.comments=[],this.timestamp=F,this.staffEntries=new Array(D),this.parentMeasure=R}$get$(R){return this.staffEntries[R]}$set$(R,F){this.staffEntries[R]=F}get Timestamp(){return this.timestamp}set Timestamp(R){this.timestamp=R}get StaffEntries(){return this.staffEntries}set StaffEntries(R){this.staffEntries=R}get Comments(){return this.comments}set Comments(R){this.comments=R}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(R){this.parentMeasure=R}getAbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}class SourceStaffEntry{constructor(R,F){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=R,this.parentStaff=F}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return Fraction$1.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(R){this.voiceEntries=R}get Link(){return this.staffEntryLink}set Link(R){this.staffEntryLink=R}get Instructions(){return this.instructions}set Instructions(R){this.instructions=R}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(R){this.chordSymbolContainers=R}removeAllInstructionsOfTypeClefInstruction(){let R=0,F=0;for(;R0)return!0;return!1}hasTie(){for(let R=0,F=this.VoiceEntries.length;RF.parentRepetition.StartIndex)return-1}if(R.alignment===AlignmentType.Begin&&F.alignment===AlignmentType.Begin){if(R.parentRepetition.EndIndexF.parentRepetition.EndIndex)return-1}}return 0}}class RepetitionInstruction{constructor(R,F,D=AlignmentType.End,G=void 0,U=void 0){this.endingIndices=void 0,this.measureIndex=R,U&&(this.endingIndices=U.slice()),this.type=F,this.alignment=D,this.parentRepetition=G}CompareTo(R){const F=R;if(this.measureIndex>F.measureIndex)return 1;if(this.measureIndex(B[B.StartLine=0]="StartLine",B[B.ForwardJump=1]="ForwardJump",B[B.BackJumpLine=2]="BackJumpLine",B[B.Ending=3]="Ending",B[B.DaCapo=4]="DaCapo",B[B.DalSegno=5]="DalSegno",B[B.Fine=6]="Fine",B[B.ToCoda=7]="ToCoda",B[B.DalSegnoAlFine=8]="DalSegnoAlFine",B[B.DaCapoAlFine=9]="DaCapoAlFine",B[B.DalSegnoAlCoda=10]="DalSegnoAlCoda",B[B.DaCapoAlCoda=11]="DaCapoAlCoda",B[B.Coda=12]="Coda",B[B.Segno=13]="Segno",B[B.None=14]="None",B))(RepetitionInstructionEnum||{}),AlignmentType=(B=>(B[B.Begin=0]="Begin",B[B.End=1]="End",B))(AlignmentType||{});let prevSourceMeasure=null;class SourceMeasure{constructor(R,F){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.metronomeNoteIndex=0,this.completeNumberOfStaves=R,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=SystemLinesEnum.SingleThin,this.firstInstructionsStaffEntries=new Array(R),this.lastInstructionsStaffEntries=new Array(R),this.rules=F,this.TempoInBPM=0;for(let D=0;D1)return R[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(R){this.verticalMeasureList=R}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(R){this.tempoInBPM=R}findOrCreateStaffEntry(R,F,D){let G,U;for(const q of this.verticalSourceStaffEntryContainers)if(q.Timestamp.Equals(R)){U=q;break}if(U)return U.StaffEntries[F]?G=U.StaffEntries[F]:(G=new SourceStaffEntry(U,D),U.StaffEntries[F]=G),{createdNewContainer:!1,staffEntry:G};const W=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||W.Timestamp.lt(R)){const q=new VerticalSourceStaffEntryContainer(this,R.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(q),G=new SourceStaffEntry(q,D),q.StaffEntries[F]=G}else for(let q=this.verticalSourceStaffEntryContainers.length-1;q>=0;q--){if(this.verticalSourceStaffEntryContainers[q].Timestamp.lt(R)){const Y=new VerticalSourceStaffEntryContainer(this,R.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(q+1,0,Y),G=new SourceStaffEntry(Y,D),Y.StaffEntries[F]=G;break}if(q===0){const Y=new VerticalSourceStaffEntryContainer(this,R.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(q,0,Y),G=new SourceStaffEntry(Y,D),Y.StaffEntries[F]=G;break}}return{createdNewContainer:!0,staffEntry:G}}findOrCreateVoiceEntry(R,F){let D,G=!1;for(const U of R.VoiceEntries)if(U.ParentVoice===F){D=U;break}return D||(D=new VoiceEntry(R.Timestamp,F,R),G=!0),{createdVoiceEntry:G,voiceEntry:D}}getPreviousSourceStaffEntryFromIndex(R,F){for(let D=F-1;D>=0;D--)if(this.verticalSourceStaffEntryContainers[D][R])return this.verticalSourceStaffEntryContainers[D][R]}getVerticalContainerIndexByTimestamp(R){for(let F=0,D=this.VerticalSourceStaffEntryContainers.length;F=0;j--){const Q=this.verticalSourceStaffEntryContainers[j][q+Y];if(Q!==void 0&&Q.hasTie()&&W.lt(Fraction$1.plus(Q.Timestamp,Q.calculateMaxNoteLength()))){W=Fraction$1.plus(Q.Timestamp,Q.calculateMaxNoteLength());break}}}}G.push(W)}for(let U=0,W=G.length;U0)return!0}return!1}beginsWithLineRepetition(){for(let R=0,F=this.FirstRepetitionInstructions.length;R=0&&(F=this.verticalSourceStaffEntryContainers[D].StaffEntries[R],!F);D--);return F}canBeReducedToMultiRest(){var D,G,U,W,q,Y;let R=!0,F=!1;for(const K of this.verticalSourceStaffEntryContainers)if(!!K){for(const Z of K.StaffEntries)if(!(!Z||!Z.ParentStaff.ParentInstrument.Visible)){if(Z.ChordContainers.length>0||(Z.ParentStaff.hasLyrics&&(F=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const j of Z.VoiceEntries){for(const Q of j.Notes)if(!Q.isRest()){R=!1;break}if(!R)break}}}if(!R||F||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const K of this.staffLinkedExpressions)if(K.length>0)return!1;for(const K of this.lastInstructionsStaffEntries)for(let Z=0,j=K==null?void 0:K.Instructions.length;Z=0;F--)for(let D=0;D(B[B.Fingering=0]="Fingering",B[B.String=1]="String",B))(TechnicalInstructionType||{});class TechnicalInstruction{}class PlaybackNote{constructor(R,F){this.parentEntry=R,this.parentNote=F,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,F.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===MidiInstrument.Percussion?this.MidiKey=PlaybackNote.noteToMidiDrumKey(F):this.MidiKey=F.Pitch.getHalfTone()+12:this.MidiKey=0}setLength(){this.ParentNote.NoteTie!==void 0&&this.ParentNote.NoteTie.StartNote===this.ParentNote&&(this.Length=this.ParentNote.NoteTie.Duration)}get ParentEntry(){return this.parentEntry}get ParentNote(){return this.parentNote}static noteToMidiDrumKey(R){var G;const F=R.Pitch.getHalfTone()-12,D=(G=R.Notehead)==null?void 0:G.Shape;switch(R.Pitch.Octave){case 1:switch(R.Pitch.FundamentalNote){case NoteEnum.D:switch(D){default:return 44}case NoteEnum.E:switch(D){default:return 35}case NoteEnum.F:switch(D){default:return 36}case NoteEnum.G:switch(D){default:return 41}case NoteEnum.A:switch(D){default:return 43}case NoteEnum.B:switch(D){case NoteHeadShape.TRIANGLE:return 54;default:return 47}default:return F}case 2:switch(R.Pitch.FundamentalNote){case NoteEnum.C:switch(D){case NoteHeadShape.X:return 37;default:return 38}case NoteEnum.D:switch(D){case NoteHeadShape.X:return 59;default:return 48}case NoteEnum.E:switch(D){case NoteHeadShape.X:return 42;case NoteHeadShape.CIRCLEX:return 46;case NoteHeadShape.TRIANGLE:return 56;default:return 50}case NoteEnum.F:switch(D){case NoteHeadShape.DIAMOND:return 53;default:return 51}case NoteEnum.G:switch(D){case NoteHeadShape.CIRCLEX:case NoteHeadShape.DIAMOND:return 46;default:return 42}case NoteEnum.A:switch(D){default:return 49}case NoteEnum.B:switch(D){default:return 57}default:return F}case 3:switch(R.Pitch.FundamentalNote){case NoteEnum.C:switch(D){case NoteHeadShape.CIRCLEX:return 52;default:return 55}default:return F}default:return F}}}class PlaybackEntry{constructor(R){this.notes=[],this.TimestampShift=new Fraction$1,this.parentVoiceEntry=R;for(const F of R.Notes)this.Notes.push(new PlaybackNote(this,F))}get ParentVoiceEntry(){return this.parentVoiceEntry}get Notes(){return this.notes}get Length(){if(this.Notes.length>0)return this.Notes[0].Length}set Length(R){for(const F of this.Notes)F.Length=R}get HasNotes(){return this.Notes.length>0}}class VoiceEntry{constructor(R,F,D,G=!0,U=!1,W=!1,q=!1){if(this.notes=[],this.graceVoiceEntriesBefore=[],this.graceVoiceEntriesAfter=[],this.articulations=[],this.playbackEntries=[],this.technicalInstructions=[],this.lyricsEntries=new Dictionary,this.wantedStemDirection=StemDirectionType.Undefined,this.stemDirectionXml=StemDirectionType.Undefined,this.stemDirection=StemDirectionType.Undefined,this.timestamp=R,this.parentVoice=F,this.parentSourceStaffEntry=D,this.isGrace=U,this.graceAfterMainNote=!1,this.graceNoteSlash=W,this.graceSlur=q,U||F.VoiceEntries.push(this),G&&D!==void 0){const Y=D.VoiceEntries;Y.indexOf(this)===-1&&Y.push(this)}this.mainPlaybackEntry=new PlaybackEntry(this),this.PlaybackEntries.push(this.mainPlaybackEntry)}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(R){this.timestamp=R}get Notes(){return this.notes}addNote(R){this.notes.push(R),!R.isRest()&&(R.NoteTie===void 0||R.NoteTie.StartNote===R)&&this.MainPlaybackEntry.Notes.push(new PlaybackNote(this.MainPlaybackEntry,R))}get GraceVoiceEntriesBefore(){return this.graceVoiceEntriesBefore}set GraceVoiceEntriesBefore(R){this.graceVoiceEntriesBefore=R;for(const F of this.graceVoiceEntriesBefore)F.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(R){this.graceVoiceEntriesAfter=R;for(const F of this.graceVoiceEntriesAfter)F.parentSourceStaffEntry=this.ParentSourceStaffEntry}get IsGrace(){return this.isGrace}set IsGrace(R){this.isGrace=R}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(R){this.graceAfterMainNote=R}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(R){this.graceNoteSlash=R}get GraceSlur(){return this.graceSlur}set GraceSlur(R){this.graceSlur=R}get Articulations(){return this.articulations}get PlaybackEntries(){return this.playbackEntries}get Fermata(){return this.fermata}get MainPlaybackEntry(){return this.mainPlaybackEntry}set MainPlaybackEntry(R){this.mainPlaybackEntry=R}removeMainPlaybackEntry(){this.mainPlaybackEntry!==void 0&&this.removePlaybackEntry(this.mainPlaybackEntry)}removePlaybackEntry(R){this.mainPlaybackEntry===R&&(this.mainPlaybackEntry=void 0);const F=this.playbackEntries.indexOf(R);F>-1&&this.playbackEntries.splice(F,1)}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(R){this.arpeggio=R}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(R){this.ornamentContainer=R}set WantedStemDirection(R){this.wantedStemDirection=R}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(R){this.stemDirectionXml=R}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(R){this.stemDirection=R}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(R){this.stemColorXml=R}get StemColor(){return this.stemColor}set StemColor(R){this.stemColor=R}get VolumeModifier(){return this.volumeModifier}set VolumeModifier(R){this.volumeModifier=R}get DurationModifier(){return this.durationModifier}set DurationModifier(R){this.durationModifier=R}hasArticulation(R){for(const F of this.articulations)if(F.Equals(R))return!0;return!1}static isSupportedArticulation(R){switch(R){case ArticulationEnum.accent:case ArticulationEnum.strongaccent:case ArticulationEnum.invertedstrongaccent:case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:case ArticulationEnum.spiccato:case ArticulationEnum.tenuto:case ArticulationEnum.fermata:case ArticulationEnum.invertedfermata:case ArticulationEnum.breathmark:case ArticulationEnum.caesura:case ArticulationEnum.lefthandpizzicato:case ArticulationEnum.naturalharmonic:case ArticulationEnum.snappizzicato:case ArticulationEnum.upbow:case ArticulationEnum.downbow:case ArticulationEnum.bend:case ArticulationEnum.detachedlegato:return!0;default:return!1}}hasTie(){for(let R=0,F=this.Notes.length;R0)return!0;return!1}isStaccato(){for(const R of this.Articulations)if(R.articulationEnum===ArticulationEnum.staccato)return!0;return!1}isAccent(){for(const R of this.Articulations)if(R.articulationEnum===ArticulationEnum.accent||R.articulationEnum===ArticulationEnum.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(R){let F=1;return this.lyricsEntries.forEach((D,G)=>{R===G&&(F=D)}),F}}var ArticulationEnum=(B=>(B[B.accent=0]="accent",B[B.strongaccent=1]="strongaccent",B[B.marcatoup=2]="marcatoup",B[B.marcatodown=3]="marcatodown",B[B.invertedstrongaccent=4]="invertedstrongaccent",B[B.staccato=5]="staccato",B[B.staccatissimo=6]="staccatissimo",B[B.spiccato=7]="spiccato",B[B.tenuto=8]="tenuto",B[B.fermata=9]="fermata",B[B.invertedfermata=10]="invertedfermata",B[B.breathmark=11]="breathmark",B[B.caesura=12]="caesura",B[B.lefthandpizzicato=13]="lefthandpizzicato",B[B.naturalharmonic=14]="naturalharmonic",B[B.snappizzicato=15]="snappizzicato",B[B.upbow=16]="upbow",B[B.downbow=17]="downbow",B[B.scoop=18]="scoop",B[B.plop=19]="plop",B[B.doit=20]="doit",B[B.falloff=21]="falloff",B[B.stress=22]="stress",B[B.unstress=23]="unstress",B[B.detachedlegato=24]="detachedlegato",B[B.otherarticulation=25]="otherarticulation",B[B.bend=26]="bend",B))(ArticulationEnum||{}),StemDirectionType=(B=>(B[B.Undefined=-1]="Undefined",B[B.Up=0]="Up",B[B.Down=1]="Down",B[B.None=2]="None",B[B.Double=3]="Double",B))(StemDirectionType||{}),SystemLinePosition=(B=>(B[B.MeasureBegin=0]="MeasureBegin",B[B.MeasureEnd=1]="MeasureEnd",B))(SystemLinePosition||{});class GraphicalLabel extends Clickable{constructor(R,F,D,G,U=void 0){super(),this.label=R,this.boundingBox=new BoundingBox$2(this,U),this.label.fontHeight=F,this.label.textAlignment=D,this.rules=G,this.rules.MpatMode&&this.label.text==="TRIO"&&(this.label.fontFamily="Arial")}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var q,Y;if(this.Label.text.trim()==="")return;this.TextLines=[];const R=(Y=(q=this.rules)==null?void 0:q.LabelMarginBorderFactor)!=null?Y:.1,F=this.Label.text.split(/[\n\r]+/g),D=F.length;let G=0;for(let K=0;K0&&this.TextLines.length>1&&(U+=this.rules.SpacingBetweenTextLines*D/10);const W=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:W.BorderTop=-U,W.BorderLeft=-G/2,W.BorderBottom=0,W.BorderRight=G/2;break;case TextAlignmentEnum.CenterCenter:W.BorderTop=-U/2,W.BorderLeft=-G/2,W.BorderBottom=U/2,W.BorderRight=G/2;break;case TextAlignmentEnum.CenterTop:W.BorderTop=0,W.BorderLeft=-G/2,W.BorderBottom=U,W.BorderRight=G/2;break;case TextAlignmentEnum.LeftBottom:W.BorderTop=-U,W.BorderLeft=0,W.BorderBottom=0,W.BorderRight=G;break;case TextAlignmentEnum.LeftCenter:W.BorderTop=-U/2,W.BorderLeft=0,W.BorderBottom=U/2,W.BorderRight=G;break;case TextAlignmentEnum.LeftTop:W.BorderTop=0,W.BorderLeft=0,W.BorderBottom=U,W.BorderRight=G;break;case TextAlignmentEnum.RightBottom:W.BorderTop=-U,W.BorderLeft=-G,W.BorderBottom=0,W.BorderRight=0;break;case TextAlignmentEnum.RightCenter:W.BorderTop=-U/2,W.BorderLeft=-G,W.BorderBottom=U/2,W.BorderRight=0;break;case TextAlignmentEnum.RightTop:W.BorderTop=0,W.BorderLeft=-G,W.BorderBottom=U,W.BorderRight=0;break}W.BorderMarginTop=W.BorderTop-U*R,W.BorderMarginLeft=W.BorderLeft-U*R,W.BorderMarginBottom=W.BorderBottom+U*R,W.BorderMarginRight=W.BorderRight+U*R}}class Label{constructor(R="",F=TextAlignmentEnum.CenterBottom,D=void 0,G=!0){this.IsCreditLabel=!1,this.text=R,this.print=G,this.textAlignment=F,this.font=D,this.fontFamily=void 0}set font(R){this.fontEnumValue=R,this.fontFamily=FontStringNames[R]}get font(){return this.fontEnumValue}ToString(){return this.text}}const SpeedTag={Grava:40,Largo:46,Lento:52,Adagio:56,Larghetto:60,Andante:66,Anderato:69,Andantino:69,Moderato:88,Allegretto:108,"Allegro Moderato":108,Allegro:132,Vivace:152,Vivo:160,Vivacissimo:168,Presto:184,Prestissimo:208},SpecialMarks=["\u7EAF\u5F8B","\u7EAF\u5F8B\u7ED3\u675F"],HideWords=["\u8DF3\u8FC7\u4E0B\u4E00\u4E2A","b","#","\xA7","\xBA","X"],GradientWords=["poco rit.","rall.","rit.","accel.","molto rit.","molto rall","lentando","poco accel.","calando"],GRADIENT_SPEED_CLOSE_TAG="\u7ED3\u675F\u8303\u56F4\u901F\u5EA6",GRADIENT_SPEED_RESET_TAG="a tempo",SpecialWords=[GRADIENT_SPEED_CLOSE_TAG],SpeedKeyword="\u901F\u5EA6 ",SpeedHiddenKeyword="\u4EC5\u6587\u672C\u901F\u5EA6 ";function isSpeedKeyword(B){return B.indexOf(SpeedKeyword)===0}function isSpeedHiddenKeyword(B){return B.indexOf(SpeedHiddenKeyword)===0}function formatSpeedKeyword(B){return B.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(B){return GradientWords.includes(B)}function isSpecialMark(B){return[...Object.keys(SpeedTag),...SpecialMarks,...SpecialWords,...HideWords].map(R=>R.trim().toLocaleUpperCase()).includes(B.toLocaleUpperCase().trim())}function isTopFont(B){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(B)}var MusicSymbol=(B=>(B[B.Unused_first_Symbol=0]="Unused_first_Symbol",B[B.BLACK_HEAD=1]="BLACK_HEAD",B[B.UPWARDS_TAIL=2]="UPWARDS_TAIL",B[B.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",B[B.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",B[B.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",B[B.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",B[B.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",B[B.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",B[B.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",B[B.ROUND_HEAD=10]="ROUND_HEAD",B[B.WHITE_HEAD=11]="WHITE_HEAD",B[B.G_CLEF=12]="G_CLEF",B[B.F_CLEF=13]="F_CLEF",B[B.C_CLEF=14]="C_CLEF",B[B.BREVE=15]="BREVE",B[B.BREVE_REST=16]="BREVE_REST",B[B.COMMON_TIME=17]="COMMON_TIME",B[B.CUT_TIME=18]="CUT_TIME",B[B.WHOLE_REST=19]="WHOLE_REST",B[B.HALF_REST=20]="HALF_REST",B[B.QUARTER_REST=21]="QUARTER_REST",B[B.EIGHTH_REST=22]="EIGHTH_REST",B[B.SIXTEENTH_REST=23]="SIXTEENTH_REST",B[B.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",B[B.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",B[B.FLAT=26]="FLAT",B[B.SHARP=27]="SHARP",B[B.NATURAL=28]="NATURAL",B[B.DOUBLE_FLAT=29]="DOUBLE_FLAT",B[B.DOUBLE_SHARP=30]="DOUBLE_SHARP",B[B.ZERO=31]="ZERO",B[B.ONE=32]="ONE",B[B.TWO=33]="TWO",B[B.THREE=34]="THREE",B[B.FOUR=35]="FOUR",B[B.FIVE=36]="FIVE",B[B.SIX=37]="SIX",B[B.SEVEN=38]="SEVEN",B[B.EIGHT=39]="EIGHT",B[B.NINE=40]="NINE",B[B.DOT=41]="DOT",B[B.FERMATA=42]="FERMATA",B[B.INVERTED_FERMATA=43]="INVERTED_FERMATA",B[B.SPICCATO=44]="SPICCATO",B[B.TENUTO=45]="TENUTO",B[B.MARCATO=46]="MARCATO",B[B.MARCATISSIMO=47]="MARCATISSIMO",B[B.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",B[B.P=49]="P",B[B.F=50]="F",B[B.S=51]="S",B[B.Z=52]="Z",B[B.M=53]="M",B[B.R=54]="R",B[B.SEGNO=55]="SEGNO",B[B.CODA=56]="CODA",B[B.DRUM_CLEF=57]="DRUM_CLEF",B[B.G_CLEF_SUB8=58]="G_CLEF_SUB8",B[B.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",B[B.G_CLEF_SUB15=60]="G_CLEF_SUB15",B[B.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",B[B.F_CLEF_SUB8=62]="F_CLEF_SUB8",B[B.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",B[B.F_CLEF_SUB15=64]="F_CLEF_SUB15",B[B.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",B[B.DOWN_BOW=66]="DOWN_BOW",B[B.MORDENT=67]="MORDENT",B[B.INVERTED_MORDENT=68]="INVERTED_MORDENT",B[B.TURN=69]="TURN",B[B.INVERTED_TURN=70]="INVERTED_TURN",B[B.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",B[B.RELEASE_PED=72]="RELEASE_PED",B[B.ENGAGE_PED=73]="ENGAGE_PED",B[B.VA8=74]="VA8",B[B.VB8=75]="VB8",B[B.TRILL=76]="TRILL",B[B.MA15=77]="MA15",B[B.MB15=78]="MB15",B[B.HIGH=79]="HIGH",B[B.PLAY=80]="PLAY",B[B.MIC=81]="MIC",B[B.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",B[B.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",B[B.EditPen=84]="EditPen",B[B.PEDAL_BRACKET=85]="PEDAL_BRACKET",B[B.PEDAL_MIXED=86]="PEDAL_MIXED",B[B.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",B))(MusicSymbol||{}),MusicSymbolDrawingStyle=(B=>(B[B.Normal=0]="Normal",B[B.Disabled=1]="Disabled",B[B.Selected=2]="Selected",B[B.Clickable=3]="Clickable",B[B.PlaybackSymbols=4]="PlaybackSymbols",B[B.FollowSymbols=5]="FollowSymbols",B[B.QFeedbackNotFound=6]="QFeedbackNotFound",B[B.QFeedbackOk=7]="QFeedbackOk",B[B.QFeedbackPerfect=8]="QFeedbackPerfect",B[B.Debug1=9]="Debug1",B[B.Debug2=10]="Debug2",B[B.Debug3=11]="Debug3",B))(MusicSymbolDrawingStyle||{}),PhonicScoreModes=(B=>(B[B.Following=0]="Following",B[B.Midi=1]="Midi",B[B.Manual=2]="Manual",B))(PhonicScoreModes||{});class LabelRenderSpecs{}class MusicSheetDrawer{constructor(R,F){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=R,this.splitScreenLineColor=-1,this.drawingParameters=F,this.rules=F.Rules}set Mode(R){this.phonicScoreMode=R}drawSheet(R){if(this.graphicalMusicSheet=R,this.rules=R.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const D of R.Cursors){if(!D)continue;const G=new BoundingBox$2(D);G.AbsolutePosition=D.Start,G.BorderBottom=D.End.y-D.Start.y,G.BorderRight=D.Width/2,G.BorderLeft=-D.Width/2,this.isVisible(G)&&this.drawLineAsVerticalRectangle(D,GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const F=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let D=0;D0&&(isTopFont(R.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(R.Label.textAlignment))){let ie=-1,re=!1;for(const oe of(q==null?void 0:q.AbstractExpressions)||[])if(oe.Label===R?ie=(te=oe==null?void 0:oe.parentMeasure)==null?void 0:te.measureListIndex:(ne=oe.expression)!=null&&ne.TempoInBpm&&(re=oe.expression.TempoInBpm>0),re&&ie>-1){U.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(R.Label.text,10))&&this.renderLabel(R,F,U):this.renderLabel(R,F,U)}calculateLabel(R){const F=new LabelRenderSpecs,D=R.Label,G=new BoundingBox$2(this);G.AbsolutePosition.x=R.PositionAndShape.AbsolutePosition.x,G.AbsolutePosition.y=R.PositionAndShape.AbsolutePosition.y||R.PositionAndShape.Parent.AbsolutePosition.y,F.ScreenPosition=this.applyScreenTransformation(G.AbsolutePosition),F.FontHeightInPixel=this.calculatePixelDistance(D.fontHeight);const U=this.calculatePixelDistance(R.PositionAndShape.Size.width);switch(F.BitmapWidth=Math.ceil(U),F.BitmapHeight=R.TextLines?Math.ceil(F.FontHeightInPixel*(.2+R.TextLines.length)):10,D.textAlignment){case TextAlignmentEnum.LeftTop:F.ScreenPosition.x-=F.BitmapWidth/2,F.ScreenPosition.y+=F.BitmapHeight*1.5;break;case TextAlignmentEnum.LeftCenter:F.ScreenPosition.y-=F.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:F.ScreenPosition.y-=F.BitmapHeight;break;case TextAlignmentEnum.CenterTop:F.ScreenPosition.x-=F.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:F.ScreenPosition.x-=F.BitmapWidth/2,F.ScreenPosition.y-=F.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:F.ScreenPosition.x-=F.BitmapWidth/2,F.ScreenPosition.y-=F.BitmapHeight;break;case TextAlignmentEnum.RightTop:F.ScreenPosition.x-=F.BitmapWidth;break;case TextAlignmentEnum.RightCenter:F.ScreenPosition.x-=F.BitmapWidth,F.ScreenPosition.y-=F.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:F.ScreenPosition.x-=F.BitmapWidth,F.ScreenPosition.y-=F.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}return F}applyScreenTransformations(R){const F=[];for(const D of R)F.push(this.applyScreenTransformation(D));return F}drawSplitScreenLine(){}renderRectangle(R,F,D,G=void 0,U=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(R){}drawSelectionEndSymbol(R){}renderLabel(R,F,D){throw new Error("not implemented")}renderSystemToScreen(R,F,D){}drawSkyLine(R){}drawBottomLine(R){}drawInstrumentBrace(R,F){}drawGroupBracket(R,F){}isVisible(R){return!0}drawMusicSystem(R){const F=this.getSystemAbsBoundingRect(R),D=this.getSytemBoundingBoxInPixels(F);this.drawMusicSystemComponents(R,D,F)}getSytemBoundingBoxInPixels(R){const F=this.applyScreenTransformationForRect(R);return F.x=Math.round(F.x),F.y=Math.round(F.y),F}getSystemAbsBoundingRect(R){const F=R.PositionAndShape.BoundingRectangle;return new RectangleF2D(R.PositionAndShape.AbsolutePosition.x+R.PositionAndShape.BorderLeft-1,R.PositionAndShape.AbsolutePosition.y+R.PositionAndShape.BorderTop-1,F.width+6,F.height+2)}drawMusicSystemComponents(R,F,D){const G=this.graphicalMusicSheet.SelectionStartSymbol,U=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&G!==void 0&&this.isVisible(G.PositionAndShape)&&this.drawSelectionStartSymbol(G),this.drawingParameters.drawSelectionEndSymbol&&U!==void 0&&this.isVisible(U.PositionAndShape)&&this.drawSelectionEndSymbol(U);for(const Y of R.StaffLines)this.drawStaffLine(Y),this.rules.RenderLyrics&&(Y.LyricsDashes.length>0&&this.drawDashes(Y.LyricsDashes),Y.LyricLines.length>0&&this.drawLyricLines(Y.LyricLines,Y));for(const Y of R.SystemLines)this.drawSystemLineObject(Y);if(R.Parent===R.Parent.Parent.MusicPages[0])for(const Y of R.Labels)Y.SVGNode=this.drawLabel(Y,GraphicalLayers.Notes);const W=this.graphicalMusicSheet.ParentMusicSheet.Instruments,q=W.filter(Y=>Y.Visible).length;for(const Y of R.InstrumentBrackets)this.drawInstrumentBrace(Y,R);if(W.length>0)if(q>1)for(const Y of R.GroupBrackets)this.drawGroupBracket(Y,R);else for(const Y of R.GroupBrackets)Y.Visible=!1;if(!this.leadSheet)for(const Y of R.MeasureNumberLabels)Y.SVGNode=this.drawLabel(Y,GraphicalLayers.Notes);for(const Y of R.StaffLines)this.drawStaffLineSymbols(Y);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(R)}activateSystemRendering(R,F,D,G){return!0}drawSystemLineObject(R){}drawStaffLine(R){for(const F of R.Measures)this.drawMeasure(F);this.rules.RenderLyrics&&R.LyricsDashes.length>0&&this.drawDashes(R.LyricsDashes),this.drawOctaveShifts(R),this.drawPedals(R),this.drawWavyLines(R),this.drawExpressions(R),this.skyLineVisible&&this.drawSkyLine(R),this.bottomLineVisible&&this.drawBottomLine(R)}drawLyricLines(R,F){F.LyricLines.forEach(D=>{D.Start.y+=F.PositionAndShape.AbsolutePosition.y,D.End.y+=F.PositionAndShape.AbsolutePosition.y,D.Start.x+=F.PositionAndShape.AbsolutePosition.x,D.End.x+=F.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(D,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(R){}drawGraphicalLine(R,F,D="black"){return this.drawLine(R.Start,R.End,D,F)}drawLine(R,F,D="#FF0000FF",G){}drawDashes(R){R.forEach(F=>F.SVGNode=this.drawLabel(F,GraphicalLayers.Notes))}drawOctaveShifts(R){}drawStaffLines(R){if(R.StaffLines){const F=R.PositionAndShape.AbsolutePosition;for(let D=0;D<5;D++)this.drawLineAsHorizontalRectangleWithOffset(R.StaffLines[D],F,GraphicalLayers.Notes)}}drawSymbol(R,F,D,G=1,U=GraphicalLayers.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(R){this.graphicalMusicSheet.LeadSheet=R}drawPage(R){if(!!this.isVisible(R.PositionAndShape)){for(const F of R.MusicSystems)this.isVisible(F.PositionAndShape)&&this.drawMusicSystem(F);if(R===R.Parent.MusicPages[0])for(const F of R.Labels)F.SVGNode=this.drawLabel(F,GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(R.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(R,F=0,D="all"){const G=R.DataObject.constructor.name;let U=!1;D==="all"&&(U=!0),(U||G===D)&&this.drawBoundingBox(R,void 0,!0,G,F),F++,R.ChildElements.forEach(W=>this.drawBoundingBoxes(W,F,D))}drawBoundingBox(R,F=void 0,D=!1,G=void 0,U=0){let W=new RectangleF2D(R.AbsolutePosition.x+R.BorderMarginLeft,R.AbsolutePosition.y+R.BorderMarginTop,R.BorderMarginRight-R.BorderMarginLeft,R.BorderMarginBottom-R.BorderMarginTop);D&&(this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(R.AbsolutePosition.x-1,R.AbsolutePosition.y),new PointF2D(R.AbsolutePosition.x+1,R.AbsolutePosition.y),.1,OutlineAndFillStyleEnum.BaseWritingColor,F),U-1),this.drawLineAsVerticalRectangle(new GraphicalLine(new PointF2D(R.AbsolutePosition.x,R.AbsolutePosition.y-1),new PointF2D(R.AbsolutePosition.x,R.AbsolutePosition.y+1),.1,OutlineAndFillStyleEnum.BaseWritingColor,F),U-1)),W=this.applyScreenTransformationForRect(W);const q=this.renderRectangle(W,GraphicalLayers.Background,U,F,.5);if(G){const Y=new Label(G),K=new LabelRenderSpecs;K.BitmapWidth=W.width,K.BitmapHeight=W.height,K.FontHeightInPixel=W.height,K.ScreenPosition=new PointF2D(W.x,W.y+12),this.renderLabel(new GraphicalLabel(Y,.8,TextAlignmentEnum.CenterCenter,this.rules),U,K)}return q}drawMarkedAreas(R){for(const F of R.GraphicalMarkedAreas)F&&(F.systemRectangle&&this.drawRectangle(F.systemRectangle,GraphicalLayers.Background),F.settings&&(F.settings.SVGNode=this.drawLabel(F.settings,GraphicalLayers.Comment)),F.labelRectangle&&this.drawRectangle(F.labelRectangle,GraphicalLayers.Background),F.label&&(F.label.SVGNode=this.drawLabel(F.label,GraphicalLayers.Comment)))}drawStaffLineSymbols(R){const F=R.ParentStaff.ParentInstrument,D=R.PositionAndShape.AbsolutePosition.x,G=R.PositionAndShape.AbsolutePosition.y+2,U=R.PositionAndShape.BorderRight;F.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(D,G),new PointF2D(D+U,G),4,OutlineAndFillStyleEnum.Highlighted),GraphicalLayers.Highlight);let W=MusicSymbolDrawingStyle.Disabled,q=MusicSymbol.PLAY,Y=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case PhonicScoreModes.Midi:q=MusicSymbol.PLAY,this.midiPlaybackAvailable&&R.ParentStaff.audible&&(W=MusicSymbolDrawingStyle.PlaybackSymbols);break;case PhonicScoreModes.Following:q=MusicSymbol.MIC,R.ParentStaff.following&&(W=MusicSymbolDrawingStyle.FollowSymbols);break;default:Y=!1;break}if(Y){const K=new PointF2D(D+U+2,G);this.drawSymbol(q,W,K)}if(this.drawingParameters.drawErrors)for(const K of R.Measures){const Z=K.PositionAndShape,j=Z.AbsolutePosition.x,Q=Z.AbsolutePosition.y+2;K.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(j,Q),new PointF2D(j+Z.BorderRight,Q),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}}class VexFlowTextMeasurer{constructor(R){this.fontSize=20,this.fontSizeStandard=this.fontSize;const F=document.createElement("canvas");this.context=F.getContext("2d"),this.rules=R}computeTextWidthToHeightRatio(R,F,D,G=void 0,U=this.fontSize){return this.context.font=VexFlowConverter.font(U,D,F,this.rules,G),this.context.measureText(R).width/U}setFontSize(R=this.fontSizeStandard){return this.fontSize=R,R}}class AbstractGraphicalExpression extends GraphicalObject{constructor(R,F,D){super(),this.expression=F,this.parentMeasure=D,this.boundingBox=new BoundingBox$2(this,R.PositionAndShape),this.parentStaffLine=R,this.parentStaffLine.AbstractExpressions.push(this),this.rules=R.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}}class GraphicalInstantaneousTempoExpression extends AbstractGraphicalExpression{constructor(R,F){super(F.PositionAndShape.Parent.DataObject,R,R.parentMeasure),this.label=F}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression{constructor(R,F,D){super(F,R,D.parentSourceMeasure),this.mInstantaneousDynamicExpression=R,this.mMeasure=D}updateSkyBottomLine(){const R=this.parentStaffLine.SkyBottomLineCalculator,F=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,D=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let G=0;switch(this.Placement){case PlacementEnum.Above:G=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,R.updateSkyLineInRange(F,D,G);break;case PlacementEnum.Below:G=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,R.updateBottomLineInRange(F,D,G);break;default:log$2.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpression{constructor(R,F,D){super(F,R,D),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(R){this.startMeasure=R}get EndMeasure(){return this.endMeasure}set EndMeasure(R){this.endMeasure=R}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(R){this.isSplittedPart=R}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(R){this.notToBeRemoved=R}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var G;const R=this.parentStaffLine.SkyBottomLineCalculator,F=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,D=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsVerbal&&this.lines.length<2&&log$2.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==ContDynamicEnum.diminuendo&&log$2.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+((G=this.startMeasure)==null?void 0:G.MeasureNumber)),this.Placement){case PlacementEnum.Above:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?R.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&R.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{const U=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;R.updateSkyLineInRange(F,D,U)}break;case PlacementEnum.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?R.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&R.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{const U=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;R.updateBottomLineInRange(F,D,U)}break;default:log$2.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(R,F,D,G=this.rules.WedgeOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(R,D),q=new PointF2D(F,D-G/2),Y=new PointF2D(F,D+G/2);this.addWedgeLines(W,q,Y,U)}createFirstHalfCrescendoLines(R,F,D,G=this.rules.WedgeMeasureEndOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(R,D),q=new PointF2D(F,D-G/2),Y=new PointF2D(F,D+G/2);this.addWedgeLines(W,q,Y,U)}createSecondHalfCrescendoLines(R,F,D,G=this.rules.WedgeMeasureBeginOpeningLength,U=this.rules.WedgeOpeningLength,W=this.rules.WedgeLineWidth){const q=new PointF2D(R,D-G/2),Y=new PointF2D(R,D+G/2),K=new PointF2D(F,D-U/2),Z=new PointF2D(F,D+U/2);this.addDoubleLines(q,K,Y,Z,W)}recalculateCrescendoLines(R,F,D){const G=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),G?this.createSecondHalfCrescendoLines(R,F,D):this.isSplittedPart?this.createFirstHalfCrescendoLines(R,F,D):this.createCrescendoLines(R,F,D)}createDiminuendoLines(R,F,D,G=this.rules.WedgeOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(R,D-G/2),q=new PointF2D(R,D+G/2),Y=new PointF2D(F,D);this.addWedgeLines(Y,W,q,U)}createFirstHalfDiminuendoLines(R,F,D,G=this.rules.WedgeOpeningLength,U=this.rules.WedgeMeasureEndOpeningLength,W=this.rules.WedgeLineWidth){const q=new PointF2D(R,D-G/2),Y=new PointF2D(R,D+G/2),K=new PointF2D(F,D-U/2),Z=new PointF2D(F,D+U/2);this.addDoubleLines(q,K,Y,Z,W)}createSecondHalfDiminuendoLines(R,F,D,G=this.rules.WedgeMeasureBeginOpeningLength,U=this.rules.WedgeLineWidth){const W=new PointF2D(R,D-G/2),q=new PointF2D(R,D+G/2),Y=new PointF2D(F,D);this.addWedgeLines(Y,W,q,U)}recalculateDiminuendoLines(R,F,D){const G=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),G?this.createFirstHalfDiminuendoLines(R,F,D):this.isSplittedPart?this.createSecondHalfDiminuendoLines(R,F,D):this.createDiminuendoLines(R,F,D)}calcPsi(){if(this.IsVerbal){this.PositionAndShape.calculateBoundingBox();return}this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[0].End.x-this.lines[0].Start.x):(this.PositionAndShape.BorderMarginLeft=this.lines[0].End.x-this.lines[0].Start.x,this.PositionAndShape.BorderMarginRight=0)}cleanUp(){this.lines.clear()}shiftYPosition(R){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=R,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=R,this.lines[0].End.y+=R,this.lines[1].End.y+=R)}squeeze(R){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)0?this.lines[0].Start.x+=R:(this.lines[0].End.x+=R,this.lines[1].End.x+=R):R<0?this.lines[0].Start.x+=R:(this.lines[0].End.x+=R,this.lines[1].End.x+=R),this.calcPsi())}addWedgeLines(R,F,D,G){const U=new GraphicalLine(R,F,G),W=new GraphicalLine(R,D,G);this.lines.push(U),this.lines.push(W)}addDoubleLines(R,F,D,G,U){const W=new GraphicalLine(R,F,U),q=new GraphicalLine(D,G,U);this.lines.push(W),this.lines.push(q)}}class GraphicalUnknownExpression extends AbstractGraphicalExpression{constructor(R,F,D,G,U=void 0){super(R,new AbstractExpression(D),G),this.label=F,this.sourceMultiExpression=U}updateSkyBottomLine(){const R=this.parentStaffLine.SkyBottomLineCalculator,F=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,D=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:const G=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;R.updateSkyLineInRange(F,D,G);break;case PlacementEnum.Below:const U=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;R.updateBottomLineInRange(F,D,U);break;default:log$2.error("Placement for GraphicalUnknownExpression is unknown")}}}Vex.Flow;const unitInPixels=10;class VexFlowMusicSheetDrawer extends MusicSheetDrawer{constructor(R=new DrawingParameters){super(new VexFlowTextMeasurer(R.Rules),R),this.backends=[],this.zoom=1,this.pageIdx=0,this.getDotId=(F,D)=>D?String(F.Label.PositionAndShape.RelativePosition[D]):String(F.Label.PositionAndShape.RelativePosition.x)+String(F.Label.PositionAndShape.RelativePosition.y),this.hasDot=(F,D,G,U)=>{const W=D||Object.values(U);for(const q of W){if(G)return F.x===q.x&&F.y===q.y;if(F.x===q.x)return!0}return!1}}get Zoom(){return this.zoom}get Backends(){return this.backends}initializeBackendForPage(R){this.backend=this.backends[R.PageNumber-1]}drawSheet(R){var F,D,G;this.rules.DefaultVexFlowNoteFont==="gonville"&&(Vex.Flow.DEFAULT_FONT_STACK=[(F=Vex.Flow.Fonts)==null?void 0:F.Gonville,(D=Vex.Flow.Fonts)==null?void 0:D.Bravura,(G=Vex.Flow.Fonts)==null?void 0:G.Custom]),Vex.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*unitInPixels,Vex.Flow.STEM_WIDTH=this.rules.StemWidth*unitInPixels,Vex.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,Vex.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(const U of R.MusicPages){if(U.PageNumber>this.rules.MaxPageToDrawNumber)break;const W=this.backends[this.pageIdx];W.graphicalMusicPage=U,W.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(R)}drawPage(R){!R||(this.backend=this.backends[R.PageNumber-1],super.drawPage(R),this.pageIdx+=1)}clear(){for(const R of this.backends)R.clear()}setZoom(R){this.zoom=R}calculatePixelDistance(R){return R*unitInPixels}drawStaffLine(R){const F=this.backend.getContext().openGroup();F&&F.classList.add("staffline"),super.drawStaffLine(R);const D=R.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(R,D),this.backend.getContext().closeGroup()}drawSlurs(R,F){for(const D of R.GraphicalSlurs)D.slur.isCrossed()||this.drawSlur(D,F)}drawSlur(R,F){const D=[];let G,U,W,q;this.rules.DYMusicScoreType==="jianpu"?((R.placement>0||R.bezierStartPt.y>0)&&(R.bezierStartPt.y=-.8,R.bezierStartControlPt.y=-2.5),G=new PointF2D(R.bezierStartPt.x+F.x,R.bezierStartPt.y+F.y),U=new PointF2D(R.bezierStartControlPt.x+F.x,R.bezierStartControlPt.y+F.y),W=new PointF2D(R.bezierEndControlPt.x+F.x,R.bezierStartControlPt.y+F.y),q=new PointF2D(R.bezierEndPt.x+F.x,R.bezierStartPt.y+F.y)):(G=new PointF2D(R.bezierStartPt.x+F.x,R.bezierStartPt.y+F.y),U=new PointF2D(R.bezierStartControlPt.x+F.x,R.bezierStartControlPt.y+F.y),W=new PointF2D(R.bezierEndControlPt.x+F.x,R.bezierEndControlPt.y+F.y),q=new PointF2D(R.bezierEndPt.x+F.x,R.bezierEndPt.y+F.y)),D.push(this.applyScreenTransformation(G)),D.push(this.applyScreenTransformation(U)),D.push(this.applyScreenTransformation(W)),D.push(this.applyScreenTransformation(q)),R.placement===PlacementEnum.Above?(G.y-=.05,U.y-=.3,W.y-=.3,q.y-=.05):(G.y+=.05,U.y+=.3,W.y+=.3,q.y+=.05),D.push(this.applyScreenTransformation(G)),D.push(this.applyScreenTransformation(U)),D.push(this.applyScreenTransformation(W)),D.push(this.applyScreenTransformation(q)),R.SVGElement=this.backend.renderCurve(D)}drawMeasure(R){R.setAbsoluteCoordinates(R.PositionAndShape.AbsolutePosition.x*unitInPixels,R.PositionAndShape.AbsolutePosition.y*unitInPixels);const F=this.backend.getContext();try{R.draw(F)}catch(D){log$2.warn("VexFlowMusicSheetDrawer.drawMeasure",D)}for(const D of R.staffEntries)this.drawStaffEntry(D)}drawLine(R,F,D="#FF0000FF",G=.2){return R=this.applyScreenTransformation(R),F=this.applyScreenTransformation(F),this.backend.renderLine(R,F,D,G*unitInPixels)}DrawOverlayLine(R,F,D,G="#FF0000FF",U=.2){if(!D.PageNumber||D.PageNumber>this.backends.length||D.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const W=D.PageNumber-1,q=this.backends[W];return R=this.applyScreenTransformation(R),F=this.applyScreenTransformation(F),q.renderLine(R,F,G,U*unitInPixels)}drawSkyLine(R){const F=R.PositionAndShape.AbsolutePosition,D=R.PositionAndShape.Size.width;this.drawSampledLine(R.SkyLine,F,D)}drawBottomLine(R){const F=new PointF2D(R.PositionAndShape.AbsolutePosition.x,R.PositionAndShape.AbsolutePosition.y),D=R.PositionAndShape.Size.width;this.drawSampledLine(R.BottomLine,F,D,"#0000FFFF")}drawSampledLine(R,F,D,G="#FF0000FF"){const U=[];let W=0;for(let Y=0;Y0){const Y=this.rules.SamplingUnit;let K=new PointF2D(q.x,q.y),Z=new PointF2D(U[0]/Y+q.x,q.y);this.drawLine(K,Z,G);let j,Q;R[0]>=0&&(j=new PointF2D(U[0]/Y+q.x,q.y),Q=new PointF2D(U[0]/Y+q.x,q.y+R[U[0]]),this.drawLine(j,Q,G));for(let J=1;J0)for(const F of R.FingeringEntries)F.SVGNode=this.drawLabel(F,GraphicalLayers.Notes);if(R.graphicalChordContainers!==void 0&&R.graphicalChordContainers.length>0)for(const F of R.graphicalChordContainers){const D=F.GraphicalLabel;D.SVGNode=this.drawLabel(D,GraphicalLayers.Notes)}this.rules.RenderLyrics&&R.LyricsEntries.length>0&&this.drawLyrics(R.LyricsEntries,GraphicalLayers.Notes)}drawLyrics(R,F){R.forEach(D=>{const G=D.GraphicalLabel;G.SVGNode=this.drawLabel(G,F)})}drawInstrumentBrace(R,F){R.draw(this.backend.getContext())}drawGroupBracket(R,F){R.draw(this.backend.getContext())}drawOctaveShifts(R){for(const F of R.OctaveShifts)if(F){const D=F,G=this.backend.getContext(),U=D.getTextBracket();U.setContext(G);try{U.draw()}catch(W){log$2.warn(W)}}}drawPedals(R){for(const F of R.Pedals)if(F){const D=F,G=this.backend.getContext(),U=D.getPedalMarking();U.setContext(G),U.draw()}}drawWavyLines(R){for(const F of R.WavyLines)if(F){const D=F,G=this.backend.getContext(),U=D.getVibratoBracket();U.setContext(G),U.draw()}}getMaxExpressionsYAndDots(R){var Y,K;const F=[];let D=0;for(const Z of R.measures)F.push(Z.measureNumber);const G={},U={},W={};for(const Z of R.AbstractExpressions)if(Z instanceof GraphicalUnknownExpression&&F.includes(Z.parentMeasure.MeasureNumber)){const j=this.getDotId(Z),Q=this.getDotId(Z,"x");U[j]||(U[j]=[]),W[Q]||(W[Q]=[]),this.hasDot(Z.Label.PositionAndShape.RelativePosition,U[j],!0)||(U[j].push(Z.Label.PositionAndShape.RelativePosition),W[Q].push(Z.Label.PositionAndShape.RelativePosition)),G[j]=Z.Label.PositionAndShape.RelativePosition}let q=0;for(const Z of R.AbstractExpressions){const j=(Y=Z.parentMeasure)==null?void 0:Y.MeasureNumber;if(Z instanceof GraphicalUnknownExpression&&F.includes(j)){const Q=(K=Z.parentMeasure.verticalMeasureList[0])==null?void 0:K.stave,J=(Q==null?void 0:Q.end_x)-(Q==null?void 0:Q.x),te=this.getDotId(Z,"x");if((W[te]||[]).length===1&&q!==j){const ne=Z.Label.PositionAndShape.AbsolutePosition.y;D=D===0?ne:Math.min(D,ne)}(W[te]||[]).length!==1&&J/101){let D=Math.min(...R.Lines.map(G=>G.Start.x));R.Lines[0].Start.x=D,R.Lines[1].Start.x=D,[R.Lines[0].Start.y,R.Lines[1].Start.y]=[R.Lines[1].Start.y,R.Lines[0].Start.y],R.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,R.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch{}const F=this.backend.getContext();F.openGroup("lineGroup");for(const D of R.Lines){const G=new PointF2D(R.ParentStaffLine.PositionAndShape.AbsolutePosition.x+D.Start.x,R.ParentStaffLine.PositionAndShape.AbsolutePosition.y+D.Start.y),U=new PointF2D(R.ParentStaffLine.PositionAndShape.AbsolutePosition.x+D.End.x,R.ParentStaffLine.PositionAndShape.AbsolutePosition.y+D.End.y);this.drawLine(G,U,"black",D.Width)}F.closeGroup()}}renderLabel(R,F,D){return this._renderLabel(R,D)}_renderLabel(R,F){var K;if(!R.Label.print)return;const D=R.Label.fontHeight*unitInPixels,{font:G}=R.Label;let U;this.rules.ColoringEnabled&&(U=R.Label.colorDefault,R.Label.color&&(U=R.Label.color.toString()),U||(U=this.rules.DefaultColorLabel));let{fontStyle:W,fontFamily:q}=R.Label;W||(W=this.rules.DefaultFontStyle),q||(q=this.rules.DefaultFontFamily);let Y;for(let Z=0;Z<((K=R.TextLines)==null?void 0:K.length);Z++){const j=R.TextLines[Z],Q=this.calculatePixelDistance(j.xOffset),J=new PointF2D(F.ScreenPosition.x+Q,F.ScreenPosition.y),te=this.backend.renderText(D,W,G,j.text,F.FontHeightInPixel,J,U,R.Label.fontFamily);Y?Y.appendChild(te):Y=te,F.ScreenPosition.y=F.ScreenPosition.y+F.FontHeightInPixel,R.TextLines.length>1&&(F.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return Y}renderRectangle(R,F,D,G,U){return this.backend.renderRectangle(R,D,G,U)}applyScreenTransformation(R){return new PointF2D(R.x*unitInPixels,R.y*unitInPixels)}applyScreenTransformationForRect(R){return new RectangleF2D(R.x*unitInPixels,R.y*unitInPixels,R.width*unitInPixels,R.height*unitInPixels)}}const VF$c=Vex.Flow,_VexFlowConverter=class{static durations(B,R){const F=[],D=B.clone();for(;D.RealValue>0;){const G=D.RealValue;if(G>=2)F.push("1/2"),D.Sub(new Fraction$1(2,1));else if(G>=1)F.push("w"),D.Sub(new Fraction$1(1,1));else if(G<1&&G>=.5){if(R&&G>.5)return["w"];F.push("h"),D.Sub(new Fraction$1(1,2))}else if(G<.5&&G>=.25){if(R&&G>.25)return["h"];F.push("q"),D.Sub(new Fraction$1(1,4))}else if(G<.25&&G>=.125){if(R&&G>.125)return["q"];F.push("8"),D.Sub(new Fraction$1(1,8))}else if(G<.125&&G>=.0625){if(R&&G>.0625)return["8"];F.push("16"),D.Sub(new Fraction$1(1,16))}else if(G<.0625&&G>=.03125){if(R&&G>.03125)return["16"];F.push("32"),D.Sub(new Fraction$1(1,32))}else if(G<.03125&&G>=.015625){if(R&&G>.015625)return["32"];F.push("64"),D.Sub(new Fraction$1(1,64))}else{if(R)return["64"];F.push("128"),D.Sub(new Fraction$1(1,128))}}return F}static pitch(B,R,F,D=void 0,G=void 0){let U=G;G===void 0&&(U=3),R&&G===void 0&&(U=0,F.ClefType===ClefEnum.F&&(U=2),F.ClefType===ClefEnum.C&&(U=2));const W=NoteEnum[B.FundamentalNote].toLowerCase(),q=Pitch.accidentalVexflow(B.Accidental),Y=B.Octave-F.OctaveOffset+U;let K="";return D&&(K=this.NoteHeadCode(D)),[W+"n/"+Y+K,q,F]}static restToNotePitch(B,R){let F=B.Octave;switch(R){case ClefEnum.C:case ClefEnum.F:{F+=2;break}case ClefEnum.G:}return new Pitch(B.FundamentalNote,F,AccidentalEnum.NONE)}static NoteHeadCode(B){const R="/",F=B.Filled?"2":"1";switch(B.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return R+"D"+F;case NoteHeadShape.TRIANGLE:return R+"T"+F;case NoteHeadShape.X:return R+"X"+F;case NoteHeadShape.CIRCLEX:return R+"X3";case NoteHeadShape.RECTANGLE:return R+"R"+F;case NoteHeadShape.SQUARE:return R+"S"+F;case NoteHeadShape.SLASH:return"";default:return""}}static GhostNotes(B){const R=[],F=_VexFlowConverter.durations(B,!1);for(const D of F)R.push(new VF$c.GhostNote({duration:D}));return R}static StaveNote(B){var he,ge,ce,me,ye,ve,pe,be,xe,ue,_e,Be,Ae,Pe,Ie,Ce;B.sortForVexflow();const R=B.notes,F=B.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,D=R[0];let G=[],U;const W=[],q=D.graphicalNoteLength,Y=D.sourceNote.NoteTuplet!==void 0;let K=_VexFlowConverter.durations(q,Y)[0];D.sourceNote.TypeLength!==void 0&&D.sourceNote.TypeLength!==q&&D.sourceNote.TypeLength.RealValue!==0&&(K=_VexFlowConverter.durations(D.sourceNote.TypeLength,Y)[0],D.numberOfDots=D.sourceNote.DotsXml);let Z,j=D.numberOfDots,Q=!1,J=0,te=!1,ne=!1,ie;for(const Te of R){if(j=1&&$e.length-1>=qe+1&&(We=(ye=(me=$e[qe-1])==null?void 0:me.graphicalVoiceEntries[0])==null?void 0:ye.parentVoiceEntry,Ve=(pe=(ve=$e[qe+1])==null?void 0:ve.graphicalVoiceEntries[0])==null?void 0:pe.parentVoiceEntry,We&&Ve)){const et=We.Notes[0],ot=Ve.Notes[0];if(((be=et.NoteBeam)==null?void 0:be.Notes.includes(ot))&&ot.ParentStaffEntry.ParentStaff.StafflineCount!==1){const ft=We.Notes.last().Pitch,lt=Te.Clef(),Ee=_VexFlowConverter.pitch(_VexFlowConverter.restToNotePitch(ft.getTransposedPitch(-2),lt.ClefType),!1,lt);ft.FundamentalNote===4&&(G=[Ee[0]])}}}}if(q.RealValue===Te.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(G=F.DYMusicScoreType==="staff"?["d/5"]:["R/5"],K="w",j=0,Q=!0,J=F.WholeRestXShiftVexflow*unitInPixels),[...Te.sourceNote.ParentStaff.Voices].filter(ke=>(ke==null?void 0:ke.VoiceId)!=1).length){const ke=Te.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,$e=Te.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let We,Ve;for(const qe of ke)for(const et of qe.notes){if(et===Te||et.sourceNote.isRest()||!et.sourceNote.PrintObject){Te.lineShift=-2;continue}const ot=et.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,ft=$e===1||$e===5,lt=ft?1:-1,je=et.sourceNote.Pitch.getHalfTone(),Ke=lt===1&&je>We,Oe=lt===-1&&je0){let qe=3;const et=Te.Clef();switch(et.ClefType){case ClefEnum.F:qe=5;break;case ClefEnum.C:qe=4;break}ie=Pitch.fromHalftone(We),G=[_VexFlowConverter.pitch(ie,!0,et,void 0,qe)[0]]}}break}Te.sourceNote.Notehead&&Te.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(te=!0);const Se=Te.vfpitch;if((ue=(xe=Se[2])==null?void 0:xe.Parent)!=null&&ue.Instructions)for(let Ne=0,Ge=Se[2].Parent.Instructions.length;NeB.notes[Se].staffLine=Te),(F.LedgerLineWidth||F.LedgerLineStrokeStyle)&&(re.ledgerLineStyle||(re.ledgerLineStyle={}),F.LedgerLineWidth&&(re.ledgerLineStyle.lineWidth=F.LedgerLineWidth),F.LedgerLineStrokeStyle&&(re.ledgerLineStyle.strokeStyle=F.LedgerLineStrokeStyle)),F.ColoringEnabled){const Te=F.DefaultColorStem;let Se=B.parentVoiceEntry.StemColor;!Se&&Te&&(Se=Te);const Ne={fillStyle:Se,strokeStyle:Se};Se&&(re.setStemStyle(Ne),re.flag&&F.ColorFlags&&re.setFlagStyle(Ne))}if(re.x_shift=J,B.parentVoiceEntry.IsGrace&&B.notes[0].sourceNote.NoteBeam&&(B.parentVoiceEntry.WantedStemDirection=B.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),B.parentVoiceEntry)switch(B.parentVoiceEntry.WantedStemDirection){case StemDirectionType.Up:re.setStemDirection(VF$c.Stem.UP),B.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:re.setStemDirection(VF$c.Stem.DOWN),B.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}for(let Te=0,Se=R.length;Te0&&Ge==="single"){const ke=new VF$c.Tremolo(Ne);ke.extra_stroke_scale=F.TremoloStrokeScale,ke.y_spacing_scale=F.TremoloYSpacingScale,re&&re.duration==="w"&&re.stem.setExtension(-9),re.addModifier(Te,ke)}if(Ne>0&&Ge==="start"&&this.noteTremoloList.push(re),Ne>0&&Ge==="stop"){this.noteTremoloList.push(re);const ke=new VF$c.Tremolo(Ne,[...this.noteTremoloList]);ke.extra_stroke_scale=1.2,ke.y_spacing_scale=1.2,ke.x_shift=-30,re.addModifier(Te,ke),this.noteTremoloList=[]}this.glissandoList.length&&(re.setVibrato(this.glissandoList[0].vfnote[0]),((Ae=(Be=(_e=this.glissandoList[0])==null?void 0:_e.sourceNote)==null?void 0:Be.SourceMeasure)==null?void 0:Ae.MeasureNumberXML)!=((Ce=(Ie=(Pe=R[Te])==null?void 0:Pe.sourceNote)==null?void 0:Ie.SourceMeasure)==null?void 0:Ce.MeasureNumberXML),this.glissandoList=[]),R[Te].sourceNote.glissandoType==="start"&&this.glissandoList.push(R[Te])}if(le.Length.RealValue===.25&&le.Notehead&&le.Notehead.Filled===!1){const Te=re.getKeyProps();for(let Se=0;Se1&&re.getKeyProps().filter(Se=>!Se.code&&Se.line>3).length===G.length&&re.setStemDirection(-1),F.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&re.addAccidental(0,new VF$c.Accidental("#"));try{const Te=["b","#","\xA7","\xBA","X"],Se={b:"b","#":"#","\xA7":"n",\u00BA:"bb",X:"##"};for(const Ne of R){const Ge=Ne.sourceNote.voiceEntry.Timestamp;for(const ke of Ne.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const $e of ke){const We=Fraction$1.Equal(Ge,$e.Timestamp),qe=$e.EntriesList.map(et=>et.label).filter(et=>Te.includes(et)).map(et=>Se[et]);if(We){for(const et of qe)et&&re.addAnnotation(0,new VF$c.Annotation(et));break}}}}catch{}return re}static generateArticulations(B,R,F){var D,G;if(!(!B||B.getAttribute("type")==="GhostNote"))for(const U of R){let W=VF$c.Modifier.Position.ABOVE;B.getStemDirection()===VF$c.Stem.UP&&(W=VF$c.Modifier.Position.BELOW);let q;const Y=U.articulationEnum;switch(F.ArticulationPlacementFromXML&&(U.placement===PlacementEnum.Above?W=VF$c.Modifier.Position.ABOVE:U.placement===PlacementEnum.Below&&(W=VF$c.Modifier.Position.BELOW)),Y){case ArticulationEnum.accent:{q=new VF$c.Articulation("a>");break}case ArticulationEnum.downbow:{q=new VF$c.Articulation("am"),U.placement===void 0&&(W=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.fermata:{q=new VF$c.Articulation("a@a"),W=VF$c.Modifier.Position.ABOVE;break}case ArticulationEnum.marcatodown:{q=new VF$c.Articulation("a|");break}case ArticulationEnum.marcatoup:{q=new VF$c.Articulation("a^");break}case ArticulationEnum.invertedfermata:{q=new VF$c.Articulation("a@u"),W=VF$c.Modifier.Position.BELOW;break}case ArticulationEnum.lefthandpizzicato:{q=new VF$c.Articulation("a+");break}case ArticulationEnum.naturalharmonic:{q=new VF$c.Articulation("ah");break}case ArticulationEnum.snappizzicato:{q=new VF$c.Articulation("ao");break}case ArticulationEnum.staccatissimo:{q=new VF$c.Articulation("av");break}case ArticulationEnum.staccato:{q=new VF$c.Articulation("a.");break}case ArticulationEnum.tenuto:{q=new VF$c.Articulation("a-");break}case ArticulationEnum.upbow:{q=new VF$c.Articulation("a|"),U.placement===void 0&&(W=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.strongaccent:{q=new VF$c.Articulation("a^");break}}q&&(!B.hasStem()&&!B.isRest()&&Y==ArticulationEnum.accent&&B.getLineNumber()>=3&&(W=VF$c.Modifier.Position.ABOVE,(G=(D=B==null?void 0:B.modifiers)==null?void 0:D.filter(K=>["TREMOLO"].includes(K.getCategory().toLocaleUpperCase())))!=null&&G.length&&q.setYShift(-16)),Y===ArticulationEnum.strongaccent&&(W=VF$c.Modifier.Position.ABOVE),q.setPosition(W),B.addModifier(0,q))}}static generateOrnaments(B,R){let F=VF$c.Modifier.Position.ABOVE;R.placement===PlacementEnum.Below&&(F=VF$c.Modifier.Position.BELOW);let D;switch(R.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:{D=new VF$c.Ornament("turn_inverted"),D.setDelayed(!0);break}case OrnamentEnum.DelayedTurn:{D=new VF$c.Ornament("turn"),D.setDelayed(!0);break}case OrnamentEnum.InvertedMordent:{D=new VF$c.Ornament("mordent"),D.setDelayed(!1);break}case OrnamentEnum.InvertedTurn:{D=new VF$c.Ornament("turn_inverted"),D.setDelayed(!1);break}case OrnamentEnum.Mordent:{D=new VF$c.Ornament("mordent_inverted"),D.setDelayed(!1);break}case OrnamentEnum.Trill:{D=new VF$c.Ornament("tr"),D.setDelayed(!1);break}case OrnamentEnum.Turn:{D=new VF$c.Ornament("turn"),D.setDelayed(!1);break}default:{log$2.warn("unhandled OrnamentEnum type: "+R.GetOrnament);return}}D&&(R.AccidentalBelow!==AccidentalEnum.NONE&&D.setLowerAccidental(Pitch.accidentalVexflow(R.AccidentalBelow)),R.AccidentalAbove!==AccidentalEnum.NONE&&D.setUpperAccidental(Pitch.accidentalVexflow(R.AccidentalAbove)),D.setPosition(F),B.addModifier(0,D))}static StrokeTypeFromArpeggioType(B){switch(B){case ArpeggioType.ARPEGGIO_DIRECTIONLESS:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case ArpeggioType.BRUSH_DOWN:return VF$c.Stroke.Type.BRUSH_UP;case ArpeggioType.BRUSH_UP:return VF$c.Stroke.Type.BRUSH_DOWN;case ArpeggioType.RASQUEDO_DOWN:return VF$c.Stroke.Type.RASQUEDO_UP;case ArpeggioType.RASQUEDO_UP:return VF$c.Stroke.Type.RASQUEDO_DOWN;case ArpeggioType.ROLL_DOWN:return VF$c.Stroke.Type.ROLL_UP;case ArpeggioType.ROLL_UP:return VF$c.Stroke.Type.ROLL_DOWN;default:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(B){const R=[],F=B.notes.reverse(),D=[],G=B.notes[0].graphicalNoteLength,U=B.notes[0].sourceNote.NoteTuplet!==void 0;let W=_VexFlowConverter.durations(G,U)[0],q=0;for(const K of B.notes){const Z=K.sourceNote,j={str:Z.StringNumberTab,fret:Z.FretNumber};R.push(j),Z.BendArray&&Z.BendArray.forEach(function(Q){let J;const te=Q.bendalter-j.fret;te>1?J="Full":te===1?J="1/2":J="1/4",Q.direction==="up"?D.push({type:VF$c.Bend.UP,text:J,width:10}):D.push({type:VF$c.Bend.DOWN,text:J,width:10})}),q(B[B.VA8=0]="VA8",B[B.VB8=1]="VB8",B[B.MA15=2]="MA15",B[B.MB15=3]="MB15",B[B.NONE=4]="NONE",B))(OctaveEnum||{});class AbstractTempoExpression extends AbstractExpression{constructor(R,F,D,G){super(F),this.label=R,this.staffNumber=D,this.parentMultiTempoExpression=G}get Label(){return this.label}set Label(R){this.label=R}get Placement(){return this.placement}set Placement(R){this.placement=R}get StaffNumber(){return this.staffNumber}set StaffNumber(R){this.staffNumber=R}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(R,F){for(const D of R)if(AbstractTempoExpression.stringContainsSeparatedWord(F.toLowerCase().trim(),D.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(R,F){return R===F||R.indexOf(" "+F)!==-1||R.indexOf(F+" ")!==-1}}const _InstantaneousTempoExpression=class extends AbstractTempoExpression{constructor(B,R,F,D,G,U=!1){super(B,R,F,G),this.setTempoAndTempoType(D)}static getDefaultValueForTempoType(B){switch(B){case TempoEnum.larghissimo:return 20;case TempoEnum.grave:return 30;case TempoEnum.lento:return 48;case TempoEnum.largo:return 52;case TempoEnum.larghetto:return 63;case TempoEnum.adagio:return 70;case TempoEnum.adagietto:return 75;case TempoEnum.andanteModerato:return 88;case TempoEnum.andante:return 92;case TempoEnum.andantino:return 96;case TempoEnum.moderato:return 106;case TempoEnum.allegretto:return 112;case TempoEnum.allegroModerato:return 118;case TempoEnum.allegro:return 130;case TempoEnum.vivace:return 140;case TempoEnum.vivacissimo:return 155;case TempoEnum.allegrissimo:return 170;case TempoEnum.presto:return 184;case TempoEnum.prestissimo:return 200;default:throw new ArgumentOutOfRangeException("tempoEnum")}}static isInputStringInstantaneousTempo(B){return B?_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,B)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,B):!1}get Label(){return this.label}set Label(B){this.label=B}get Placement(){return this.placement}set Placement(B){this.placement=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(B){this.tempoInBpm=B}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(B){if(!this.label){this.tempoInBpm=B,this.tempoEnum=TempoEnum.metronomeMark;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.larghissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.larghissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.grave)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.grave;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.lento)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.lento;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.largo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.largo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.larghetto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.larghetto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.adagio)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.adagio;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.adagietto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.adagietto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andanteModerato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andanteModerato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andante)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andante;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.andantino)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.andantino;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.moderato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.moderato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegretto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegretto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegroModerato)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegroModerato;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegro)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegro;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.vivace)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.vivace;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.vivacissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.vivacissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.allegrissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.allegrissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.presto)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.presto;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,this.label)){B===0&&(B=_InstantaneousTempoExpression.getDefaultValueForTempoType(TempoEnum.prestissimo)),this.tempoInBpm=B,this.tempoEnum=TempoEnum.prestissimo;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAddons,this.label)){this.tempoInBpm=0,this.tempoEnum=TempoEnum.addon;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,this.label)){this.tempoInBpm=0,this.tempoEnum=TempoEnum.changes;return}}};let InstantaneousTempoExpression=_InstantaneousTempoExpression;InstantaneousTempoExpression.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"];InstantaneousTempoExpression.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"];InstantaneousTempoExpression.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"];InstantaneousTempoExpression.listInstantaneousTempoLargo=["Largo","Breit","broadly"];InstantaneousTempoExpression.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"];InstantaneousTempoExpression.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"];InstantaneousTempoExpression.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"];InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato=["Andante moderato"];InstantaneousTempoExpression.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"];InstantaneousTempoExpression.listInstantaneousTempoAndantino=["Andantino"];InstantaneousTempoExpression.listInstantaneousTempoModerato=["Moderato","M\xE4\xDFig","Mod\uFFFDr\uFFFD","moderately"];InstantaneousTempoExpression.listInstantaneousTempoAllegretto=["Allegretto","fast"];InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato=["Allegro moderato"];InstantaneousTempoExpression.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fr\uFFFDhlich"];InstantaneousTempoExpression.listInstantaneousTempoVivace=["Vivace","Lebhaft","Lebendig","lively and fast"];InstantaneousTempoExpression.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"];InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"];InstantaneousTempoExpression.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"];InstantaneousTempoExpression.listInstantaneousTempoPrestissimo=["Prestissimo","\xE4u\xDFerst schnell"];InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento"];InstantaneousTempoExpression.listInstantaneousTempoAddons=["assai","amoroso","cantabile","con brio","con dolore","con espressione","con fuoco","con moto","con spirito","spiritoso","espressivo","giocoso","giusto","grazioso","lesto","lugubre","maestoso","ma non troppo","marcato","molto","morendo","mosso","non tanto","piu","un poco","poco","quasi","risoluto","scherzando","sostenuto","teneramente","tempo giusto","tranquillo","sehr","lieblich","liebevoll","mit Leidenschaft","mit Liebe","amour\xF6s","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","grazi\xF6s","mit Grazie","flink","beh\xE4nde","traurig","klagend","majest\xE4tisch","aber nicht zu sehr","markant","gem\xE4\xDFigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdr\xFCcklich","getragen","gewichtig","zart","z\xE4rtlich","im angemessenen Zeitma\xDF","ruhig","ein wenig","alla marcia","ad libitum","alla breve"];var TempoEnum=(B=>(B[B.none=0]="none",B[B.larghissimo=1]="larghissimo",B[B.grave=2]="grave",B[B.lento=3]="lento",B[B.largo=4]="largo",B[B.larghetto=5]="larghetto",B[B.adagio=6]="adagio",B[B.adagietto=7]="adagietto",B[B.andanteModerato=8]="andanteModerato",B[B.andante=9]="andante",B[B.andantino=10]="andantino",B[B.moderato=11]="moderato",B[B.allegretto=12]="allegretto",B[B.allegroModerato=13]="allegroModerato",B[B.allegro=14]="allegro",B[B.vivace=15]="vivace",B[B.vivacissimo=16]="vivacissimo",B[B.allegrissimo=17]="allegrissimo",B[B.presto=18]="presto",B[B.prestissimo=19]="prestissimo",B[B.lastRealTempo=20]="lastRealTempo",B[B.addon=21]="addon",B[B.changes=22]="changes",B[B.metronomeMark=23]="metronomeMark",B))(TempoEnum||{});const _MoodExpression=class extends AbstractExpression{constructor(B,R,F){super(R),this.label=B,this.staffNumber=F,this.setMoodType()}static isInputStringMood(B){return B?_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,B)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,B):!1}get Label(){return this.label}set Label(B){this.label=B}get Mood(){return this.moodType}set Mood(B){this.moodType=B}get StaffNumber(){return this.staffNumber}set StaffNumber(B){this.staffNumber=B}get Placement(){return this.placement}set Placement(B){this.placement=B}setMoodType(){_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,this.label)?this.moodType=MoodEnum.Affettuoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,this.label)?this.moodType=MoodEnum.Agitato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,this.label)?this.moodType=MoodEnum.Animato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,this.label)?this.moodType=MoodEnum.Appassionato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,this.label)?this.moodType=MoodEnum.Brillante:_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,this.label)?this.moodType=MoodEnum.Cantabile:_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,this.label)?this.moodType=MoodEnum.Dolce:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,this.label)?this.moodType=MoodEnum.Energico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,this.label)?this.moodType=MoodEnum.Eroico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,this.label)?this.moodType=MoodEnum.Espressivo:_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,this.label)?this.moodType=MoodEnum.Furioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,this.label)?this.moodType=MoodEnum.Giocoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,this.label)?this.moodType=MoodEnum.Gioioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,this.label)?this.moodType=MoodEnum.Grandioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,this.label)?this.moodType=MoodEnum.Grazioso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,this.label)?this.moodType=MoodEnum.Lacrimoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,this.label)?this.moodType=MoodEnum.Leggiero:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,this.label)?this.moodType=MoodEnum.Maestoso:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,this.label)?this.moodType=MoodEnum.Malinconico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,this.label)?this.moodType=MoodEnum.Marcato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,this.label)?this.moodType=MoodEnum.Marziale:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,this.label)?this.moodType=MoodEnum.Mesto:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,this.label)?this.moodType=MoodEnum.Morendo:_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,this.label)?this.moodType=MoodEnum.Nobilmente:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,this.label)?this.moodType=MoodEnum.Patetico:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,this.label)?this.moodType=MoodEnum.Pesante:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,this.label)?this.moodType=MoodEnum.Saltando:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,this.label)?this.moodType=MoodEnum.Sautille:_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,this.label)?this.moodType=MoodEnum.Scherzando:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,this.label)?this.moodType=MoodEnum.Sostenuto:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,this.label)?this.moodType=MoodEnum.Spiccato:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,this.label)?this.moodType=MoodEnum.Tenerezza:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,this.label)?this.moodType=MoodEnum.Tranquillamente:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,this.label)&&(this.moodType=MoodEnum.Trionfante)}};let MoodExpression=_MoodExpression;MoodExpression.listMoodAffettuoso=["affettuoso"];MoodExpression.listMoodAgitato=["agitato"];MoodExpression.listMoodAppassionato=["appassionato"];MoodExpression.listMoodAnimato=["animato","lively"];MoodExpression.listMoodBrillante=["brillante"];MoodExpression.listMoodCantabile=["cantabile"];MoodExpression.listMoodDolce=["dolce"];MoodExpression.listMoodEnergico=["energico"];MoodExpression.listMoodEroico=["eroico"];MoodExpression.listMoodEspressivo=["espressivo"];MoodExpression.listMoodFurioso=["furioso"];MoodExpression.listMoodGiocoso=["giocoso"];MoodExpression.listMoodGioioso=["gioioso"];MoodExpression.listMoodLacrimoso=["lacrimoso"];MoodExpression.listMoodGrandioso=["grandioso"];MoodExpression.listMoodGrazioso=["grazioso"];MoodExpression.listMoodLeggiero=["leggiero"];MoodExpression.listMoodMaestoso=["maestoso"];MoodExpression.listMoodMalinconico=["malinconico"];MoodExpression.listMoodMarcato=["marcato"];MoodExpression.listMoodMarziale=["marziale"];MoodExpression.listMoodMesto=["mesto"];MoodExpression.listMoodMorendo=["morendo"];MoodExpression.listMoodNobilmente=["nobilmente"];MoodExpression.listMoodPatetico=["patetico"];MoodExpression.listMoodPesante=["pesante"];MoodExpression.listMoodSautille=["sautille"];MoodExpression.listMoodSaltando=["saltando"];MoodExpression.listMoodScherzando=["scherzando"];MoodExpression.listMoodSostenuto=["sostenuto"];MoodExpression.listMoodSpiccato=["spiccato"];MoodExpression.listMoodTenerezza=["tenerezza"];MoodExpression.listMoodTranquillamente=["tranquillamente"];MoodExpression.listMoodTrionfante=["trionfante"];var MoodEnum=(B=>(B[B.Affettuoso=0]="Affettuoso",B[B.Agitato=1]="Agitato",B[B.Appassionato=2]="Appassionato",B[B.Animato=3]="Animato",B[B.Brillante=4]="Brillante",B[B.Cantabile=5]="Cantabile",B[B.Dolce=6]="Dolce",B[B.Energico=7]="Energico",B[B.Eroico=8]="Eroico",B[B.Espressivo=9]="Espressivo",B[B.Furioso=10]="Furioso",B[B.Giocoso=11]="Giocoso",B[B.Gioioso=12]="Gioioso",B[B.Lacrimoso=13]="Lacrimoso",B[B.Grandioso=14]="Grandioso",B[B.Grazioso=15]="Grazioso",B[B.Leggiero=16]="Leggiero",B[B.Maestoso=17]="Maestoso",B[B.Malinconico=18]="Malinconico",B[B.Marcato=19]="Marcato",B[B.Marziale=20]="Marziale",B[B.Mesto=21]="Mesto",B[B.Morendo=22]="Morendo",B[B.Nobilmente=23]="Nobilmente",B[B.Patetico=24]="Patetico",B[B.Pesante=25]="Pesante",B[B.Sautille=26]="Sautille",B[B.Saltando=27]="Saltando",B[B.Scherzando=28]="Scherzando",B[B.Sostenuto=29]="Sostenuto",B[B.Spiccato=30]="Spiccato",B[B.Tenerezza=31]="Tenerezza",B[B.Tranquillamente=32]="Tranquillamente",B[B.Trionfante=33]="Trionfante",B[B.Vivace=34]="Vivace",B))(MoodEnum||{});class UnknownExpression extends AbstractExpression{constructor(R,F,D,G){super(F),this.label=R,this.staffNumber=G,D===void 0&&(D=TextAlignmentEnum.LeftBottom),this.textAlignment=D}get Label(){return this.label}get Placement(){return this.placement}set Placement(R){this.placement=R}get StaffNumber(){return this.staffNumber}set StaffNumber(R){this.staffNumber=R}get TextAlignment(){return this.textAlignment}}class MultiExpression{constructor(R,F){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=R,this.timestamp=F}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(R){this.sourceMeasure=R}get StaffNumber(){return this.staffNumber}set StaffNumber(R){this.staffNumber=R}get Timestamp(){return this.timestamp}set Timestamp(R){this.timestamp=R}get AbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(R){this.instantaneousDynamic=R}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(R){this.endingContinuousDynamic=R}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(R){this.startingContinuousDynamic=R}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(R){this.octaveShiftStart=R}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(R){this.octaveShiftEnd=R}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(R){this.combinedExpressionsText=R}getPlacementOfFirstEntry(){let R=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof InstantaneousDynamicExpression?R=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ContinuousDynamicExpression?R=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof MoodExpression?R=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof UnknownExpression&&(R=this.expressions[0].expression.Placement)),R}getFontstyleOfFirstEntry(){var F;let R=FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof ContinuousDynamicExpression||this.expressions[0].expression instanceof MoodExpression?R=FontStyles.Italic:this.expressions[0].expression instanceof UnknownExpression&&(R=(F=this.expressions[0].expression.fontStyle)!=null?F:FontStyles.Regular)),R}addExpression(R,F){R instanceof InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=R,this.instantaneousDynamic.ParentMultiExpression=this):R instanceof ContinuousDynamicExpression?this.startingContinuousDynamic=R:R instanceof MoodExpression?this.moodList.push(R):R instanceof UnknownExpression&&this.unknownList.push(R),this.addExpressionToEntryList(R,F)}CompareTo(R){return this.Timestamp.RealValue>R.Timestamp.RealValue?1:this.Timestamp.RealValue=ContinuousTempoType.allargando&&B<=ContinuousTempoType.ritenuto}get TempoType(){return this.tempoType}set TempoType(B){this.tempoType=B}get StartTempo(){return this.startTempo}set StartTempo(B){this.startTempo=B}get EndTempo(){return this.endTempo}set EndTempo(B){this.endTempo=B}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(B){this.absoluteEndTimestamp=B}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(B){const R=Fraction$1.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(B.lt(R))return-1;if(this.absoluteEndTimestamp.lt(B))return-2;const F=Fraction$1.minus(B,R).RealValue/Fraction$1.minus(this.absoluteEndTimestamp,R).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*F))}setTempoType(){_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoFaster,this.label)?this.tempoType=ContinuousTempoType.accelerando:_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoSlower,this.label)&&(this.tempoType=ContinuousTempoType.ritardando)}};let ContinuousTempoExpression=_ContinuousTempoExpression;ContinuousTempoExpression.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"];ContinuousTempoExpression.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","rallentando","ritardando","ritenuto","ritard.","ritard","riten.","riten"];var ContinuousTempoType=(B=>(B[B.accelerando=0]="accelerando",B[B.stretto=1]="stretto",B[B.stringendo=2]="stringendo",B[B.mosso=3]="mosso",B[B.piuMosso=4]="piuMosso",B[B.allargando=5]="allargando",B[B.calando=6]="calando",B[B.menoMosso=7]="menoMosso",B[B.rallentando=8]="rallentando",B[B.ritardando=9]="ritardando",B[B.ritard=10]="ritard",B[B.rit=11]="rit",B[B.ritenuto=12]="ritenuto",B[B.rubato=13]="rubato",B[B.precipitando=14]="precipitando",B))(ContinuousTempoType||{});class MultiTempoExpression{constructor(R,F){this.expressions=[],this.sourceMeasure=R,this.timestamp=F}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return Fraction$1.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(R){this.sourceMeasure=R}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(R){this.combinedExpressionsText=R}getPlacementOfFirstEntry(){let R=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof InstantaneousTempoExpression?R=this.expressions[0].Expression.Placement:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(R=this.expressions[0].Expression.Placement)),R}getFontstyleOfFirstEntry(){let R=FontStyles.Regular;return this.expressions[0].Expression instanceof InstantaneousTempoExpression?R=FontStyles.Bold:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(R=FontStyles.Italic),R}addExpression(R,F){if(this.checkIfAlreadyExists(R))return;R instanceof InstantaneousTempoExpression?this.instantaneousTempo=R:R instanceof ContinuousTempoExpression&&(this.continuousTempo=R);const D=new TempoExpressionEntry;D.prefix=F,D.Expression=R,D.label=R.Label,this.expressions.push(D)}CompareTo(R){return this.Timestamp.RealValue>R.Timestamp.RealValue?1:this.Timestamp.RealValue0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems}calculateSystemYLayout(){for(const R of this.musicSystems)this.optimizeDistanceBetweenStaffLines(R);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(R,F,D,G){for(let U=0,W=R.length;U0&&(q.beginInstructionsWidth=D),G>0&&(q.endInstructionsWidth=G)}}finalizeCurrentAndCreateNewSystem(R,F=!1,D=!0,G=!1){this.finalizeCurrentSystem(R,F,D,G),this.currentSystemParams=new SystemBuildParameters,R!==void 0&&this.measureListIndex=1){const F=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let D=0;const G=R[R.length-1];G.endLine===SystemLinesEnum.DotsBoldBoldDots&&(G.endLine=SystemLinesEnum.DotsThinBold,D=F[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-F[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=D;for(let U=0,W=F.length;U1){W=!0;break}}let q=0;for(let Y=0;Y=0&&this.measureList[ie]){const oe=(J=this.measureList[ie][0])==null?void 0:J.parentSourceMeasure;(oe==null?void 0:oe.ImplicitMeasure)&&(oe==null?void 0:oe.RhythmPrinted)&&(te=!1)}te&&(F.addRhythmAtBegin(K),F.parentSourceMeasure.RhythmPrinted=K,Q=!0)}return(Z||j||Q)&&(W+=F.beginInstructionsWidth,Q&&(W+=this.rules.RhythmRightMargin)),W}addInstructionsAtMeasureEnd(R,F,D){if(!R||!R.Instructions||R.Instructions.length===0)return 0;for(let G=0,U=R.Instructions.length;G0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=G,this.currentSystemParams.currentSystemFixWidth+=G)}addExtraInstructionMeasure(R,F,D){const G=this.currentSystemParams.currentSystem,U=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(G.StaffLines[R]);F&&U.addKeyAtBegin(F,this.activeKeys[R],this.activeClefs[R]),D!==void 0&&D.PrintObject&&U.addRhythmAtBegin(D),U.PositionAndShape.BorderLeft=0,U.PositionAndShape.BorderTop=0,U.PositionAndShape.BorderBottom=this.rules.StaffHeight;const W=this.rules.MeasureLeftMargin+U.beginInstructionsWidth+this.rules.MeasureRightMargin;return U.PositionAndShape.BorderRight=W,G.StaffLines[R].Measures.push(U),W}addStaveMeasuresToSystem(R){if(R[0]){const F=[];for(let G=0;G1){const q=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,R.measureListIndex+R.multipleRestMeasures-1);R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[q]}}finally{}const F=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,D=F[this.measureListIndex];let G=!1;return D.allRests&&(G=(W=(U=F[this.measureListIndex+D.multipleRestMeasures-1])==null?void 0:U.endsWithLineRepetition)==null?void 0:W.call(U)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||G?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:R&&R.endingBarStyleEnum!==void 0?R.endingBarStyleEnum:SystemLinesEnum.SingleThin}getLineWidth(R,F,D){let G=R.getLineWidth(F);return F===SystemLinesEnum.DotsBoldBoldDots&&(G/=2),D&&F===SystemLinesEnum.BoldThinDots&&(G+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),G}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let R=0,F=this.measureList[this.measureListIndex-1].length;R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[R])return!1;for(let F=0,D=this.measureList[R].length;F=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||R>this.measureList.length-1)return!1;for(let F=0,D=this.measureList[R].length;F1)for(let q=1;qU&&(U=Z)}for(let q=0;qthis.rules.PageHeight-this.rules.PageBottomMargin&&(G++,G<=4&&console.log(`warning: could not fit a single system on page ${R.PageNumber} and measure number ${D.GraphicalMeasures[0][0].MeasureNumber}. The PageFormat may be too small for this sheet." Will not give further warnings for all pages, only total.`))}else{const Y=this.musicSystems[q-1],K=Y.StaffLines[Y.StaffLines.length-1],Z=K.PositionAndShape;let j=this.findRequiredDistanceWithSkyBottomLine(Y,D);j=Math.max(U,j),j+=this.rules.MinSkyBottomDistBetweenSystems,((W=window==null?void 0:window.appName)==null?void 0:W.toLocaleUpperCase())==="GYM"&&(j=j<16?16:j);const Q=this.hasExpressionCounts(D);Q.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(j+=2),Q.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(j+=2),j=Math.max(j,this.rules.MinimumDistanceBetweenSystems+K.StaffHeight);const J=F+Z.RelativePosition.y+j,te=J+D.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&Y.breaksPage)&&te0&&console.log(`total amount of pages that couldn't fit a single music system: ${G} of ${R.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(R,F){const D=R.StaffLines[R.StaffLines.length-1],G=F.StaffLines[0],U=D.BottomLine,W=G.SkyLine,q=D.PositionAndShape,Y=G.PositionAndShape,K=1/this.rules.SamplingUnit;let Z=0;for(let j=0;j=W.length)break;const te=Math.max(0,J-6),ne=Math.min(W.length-1,J+6);let ie=0;for(let oe=te;oe<=ne;oe++)ie=Math.min(ie,W[oe]);const re=Q-ie;Z=Math.max(re,Z)}return Z===0&&(Z=q.BorderBottom-Y.BorderTop),Z}}class SystemBuildParameters{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}}class OctaveShiftParams{constructor(R,F,D){this.getOpenOctaveShift=R,this.getAbsoluteStartTimestamp=F,this.getAbsoluteEndTimestamp=D}}class AccidentalCalculator{constructor(){this.keySignatureNoteAlterationsDict=new Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(R){this.activeKeyInstruction=R,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const R of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(R,this.keySignatureNoteAlterationsDict.getValue(R))}checkAccidental(R,F){if(!F)return;const D=F.FundamentalNote+F.Octave*12,G=this.currentAlterationsComparedToKeyInstructionList.indexOf(D)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(D)){if(G&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(D),1),this.currentInMeasureNoteAlterationsDict.getValue(D)!==F.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(D)&&this.keySignatureNoteAlterationsDict.getValue(D)!==F.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(D),this.currentInMeasureNoteAlterationsDict.setValue(D,F.AccidentalHalfTones)):F.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(D);const U=this.currentInMeasureNoteAlterationsDict.getValue(D);if(F.Accidental===AccidentalEnum.NONE&&(Math.abs(U)===.5?F=new Pitch(F.FundamentalNote,F.Octave,AccidentalEnum.NONE):F=new Pitch(F.FundamentalNote,F.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(F.Accidental)&&!F.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(R,F)}}else if(F.Accidental!==AccidentalEnum.NONE){if(G||this.currentAlterationsComparedToKeyInstructionList.push(D),this.currentInMeasureNoteAlterationsDict.setValue(D,F.AccidentalHalfTones),this.isAlterAmbiguousAccidental(F.Accidental)&&!F.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(R,F)}else G&&(F=new Pitch(F.FundamentalNote,F.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(D),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(R,F))}isAlterAmbiguousAccidental(R){return R===AccidentalEnum.SLASHFLAT||R===AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const R=this.activeKeyInstruction.AlteratedNotes;let F;this.activeKeyInstruction.Key>0?F=AccidentalEnum.SHARP:F=AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let D=-9;D<9;D++)for(let G=0;G0?(D=K-1,R.push({startIndex:F,endIndex:D}),F=K):Q.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(D=K,R.push({startIndex:F,endIndex:D}),F=K+1)}Fte&&fe%2===0?(U.push(fe),le=ce,fe=1):fe++:le>te?(U.push(fe),le=ce,fe=1):fe++,ce>te?ye=he+1:ye=Math.ceil(ye),re===ye?oe+=1:(G.push(oe),re=ye,oe=1)}G.push(oe),U.push(fe),U=U.filter(Boolean),console.log(U,G)}return this.buildPreparedMusicSystems(U)}buildPreparedMusicSystems(R){let F=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let D=0,G=this.measureList.length;D0&&this.rules.RenderMultipleRestMeasures){j.isReducedToMultiRest=!0,j.multipleRestMeasureNumber=1;const J=j.multipleRestMeasures-1;K+=J;for(let te=1;te<=J;te++){const ne=R.SourceMeasures[j.MeasureNumber-1+te];ne.multipleRestMeasureNumber=te+1,ne.isReducedToMultiRest=!0,F.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let K,Z=0;for(let j=0,Q=R.SourceMeasures.length;j0){K.isReducedToMultiRest=!0,K.multipleRestMeasureNumber=1,Z++,J.multipleRestMeasureNumber=Z,J.isReducedToMultiRest=!0;for(let te=0;te1){K.multipleRestMeasures=Z;const te=this.createGraphicalMeasuresForSourceMeasure(K,D,U,q,G);F[K.measureListIndex]=te,Z=0,K=void 0}else Z=0,K=void 0}if(Z>1){K.multipleRestMeasures=Z,K.isReducedToMultiRest=!0;const j=this.createGraphicalMeasuresForSourceMeasure(K,D,U,q,G);F[K.measureListIndex]=j,Z=0,K=void 0}}const Y=G.map(K=>K.ClefType===ClefEnum.percussion);this.handleStaffEntries(Y),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}calculate(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}calculateXLayout(R,F){let D=0;const G=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){let U=this.graphicalMusicSheet.MeasureList[0],W=this.calculateMeasureXLayout(U);W=this.calculateMeasureWidthFromStaffEntries(U,W),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(U,W),D=W*1.2+F+G;for(let q=1;q0)return;const W=F.Measures[U];(W.MeasureNumber===0||W.MeasureNumber===1)&&(D=W.MeasureNumber),W!==F.Measures[0]&&this.rules.MeasureNumberLabelXOffset?G=this.rules.MeasureNumberLabelXOffset:G=0;const q=this.rules.UseXMLMeasureNumbers&&W.MeasureNumber===1&&W.parentSourceMeasure.getPrintedMeasureNumber()!==1;((W.MeasureNumber===D||W.MeasureNumber>=D+this.rules.MeasureNumberLabelOffset)&&!W.parentSourceMeasure.ImplicitMeasure||q)&&((W.MeasureNumber!==1||W.MeasureNumber===1&&W!==F.Measures[0]||q)&&this.calculateSingleMeasureNumberPlacement(W,F,R,G),D=W.MeasureNumber)}}calculateSingleMeasureNumberPlacement(R,F,D,G=0){const U=R.parentSourceMeasure.getPrintedMeasureNumber().toString(),W=new Label(U),q=new GraphicalLabel(W,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),Y=F.SkyBottomLineCalculator;q.setLabelPositionAndShapeBorders(),q.PositionAndShape.Parent=D.PositionAndShape;const K=F.PositionAndShape.RelativePosition.x+R.PositionAndShape.RelativePosition.x-q.PositionAndShape.BorderMarginLeft+G;let Z,j=K,Q=K-q.PositionAndShape.BorderLeft+q.PositionAndShape.BorderRight;j-=F.PositionAndShape.RelativePosition.x,Q-=F.PositionAndShape.RelativePosition.x;const J=j+.5,te=Q-.5,ne=Y.getSkyLineMinInRange(J,te);if(R===F.Measures[0]){let ie=0;if(D.GroupBrackets.length>0)for(const re of D.GroupBrackets)ie=Math.min(ie,re.PositionAndShape.BorderTop);Z=Math.min(ne,ie)}else Z=ne;Z=Math.min(0,Z),q.PositionAndShape.RelativePosition=new PointF2D(K,Z),D.MeasureNumberLabels.push(q)}calculateMeasureNumberSkyline(R){const F=R.StaffLines[0];for(const D of R.MeasureNumberLabels){let G=D.PositionAndShape.RelativePosition.x,U=G-D.PositionAndShape.BorderLeft+D.PositionAndShape.BorderRight;G-=F.PositionAndShape.RelativePosition.x,U-=F.PositionAndShape.RelativePosition.x,F.SkyBottomLineCalculator.updateSkyLineInRange(G,U,D.PositionAndShape.RelativePosition.y+D.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(R,F,D){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(R,F){let D=0,G=this.rules.StaffHeight;const U=[],W=R.SkyBottomLineCalculator;let q=R.Measures.length;for(let K=0;K0){U.push(te),D=Math.max(D,te.LyricsEntries.length);const ne=te.PositionAndShape.RelativePosition.x+j.x;let ie=Number.MAX_VALUE,re=Number.MIN_VALUE;for(let le=0;le0){const K=R.PositionAndShape.Size.width;let Z=U[0].PositionAndShape.RelativePosition.x+U[0].PositionAndShape.BorderMarginLeft+U[0].parentMeasure.PositionAndShape.RelativePosition.x;Z=Z>K?K:Z,W.updateBottomLineInRange(Z,K,Y)}return U}calculateLyricsExtendsAndDashes(R){for(let F=0,D=R.length;F0||R.UnknownList.length>0){let Y="";for(let J=0,te=R.EntriesList.length;JR.length-1&&(log$2.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=R.length-1);const F=[];for(let W=this.rules.MinMeasureToDrawIndex,q=R.length;W0)&&(G=D.getSkyLineMinInRange(j,Q));let J=0;q===0?(J+=this.rules.ChordSymbolYOffset,J+=.1):J+=this.rules.ChordSymbolYPadding,J*=-1;const te=Y.GraphicalLabel;te.PositionAndShape.RelativePosition.y=G+J,te.setLabelPositionAndShapeBorders(),te.PositionAndShape.calculateBoundingBox(),D.updateSkyLineInRange(j,Q,G+te.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(R,F){let D=Number.MAX_SAFE_INTEGER;for(const G of R)for(const U of G.graphicalChordContainers){const W=G.PositionAndShape,q=U.PositionAndShape,Y=q.BorderMarginLeft+W.AbsolutePosition.x,K=q.BorderMarginRight+W.AbsolutePosition.x;D=Math.min(D,F.getSkyLineMinInRange(Y,K))}return D}layoutMeasureWithWholeRest(R,F,D){}layoutBeams(R){}layoutArticulationMarks(R,F,D){}layoutOrnament(R,F,D){}calculateRestNotePlacementWithinGraphicalBeam(R,F,D,G,U){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(R,F,D){}calculateGraphicalVerbalContinuousDynamic(R,F){const D=R.Label,G=F.x+D.PositionAndShape.BorderMarginLeft,U=F.x+D.PositionAndShape.BorderMarginRight,W=R.ContinuousDynamic.Placement,Y=R.ParentStaffLine.SkyBottomLineCalculator;let K;W===PlacementEnum.Below?(K=Y.getBottomLineMaxInRange(G,U),D.PositionAndShape.RelativePosition=new PointF2D(F.x,K-D.PositionAndShape.BorderMarginTop)):(K=Y.getSkyLineMinInRange(G,U),D.PositionAndShape.RelativePosition=new PointF2D(F.x,K-D.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(R,F){var ue,_e,Be;const D=R.ParentStaffLine.ParentStaff.idInMusicSheet,G=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(R.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,D);if(!G){log$2.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}R.EndMeasure=G;const U=R.ParentStaffLine,W=G.ParentStaffLine,q=W&&U===W;let Y=!1;W?Y=W==null?void 0:W.isPartOfMultiStaffInstrument():U&&(Y=U==null?void 0:U.isPartOfMultiStaffInstrument());const K=Fraction$1.createFromFraction(R.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),Z=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(K),j=Z.getFirstNonNullStaffEntry().parentMeasure,Q=j.PositionAndShape.AbsolutePosition.x+j.PositionAndShape.BorderRight;let J=new Fraction$1(0,0,0);for(const Ae of Z.StaffEntries){const Pe=(ue=Ae==null?void 0:Ae.sourceStaffEntry)==null?void 0:ue.calculateMaxNoteLength();Pe!=null&&Pe.gt(J)&&(J=Pe)}const te=this.getRelativePositionInStaffLineFromTimestamp(K,D,W,Y,0),ne=Fraction$1.plus(K,J),ie=this.getRelativePositionInStaffLineFromTimestamp(ne,D,W,Y,0);ie.x>te.x&&ie.xle){const Ce=oe.StaffLines[Ae].PositionAndShape.RelativePosition.y-U.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;be=this.rules.StaffHeight+Ce/2}else be=this.rules.WedgePlacementBelowY;be-=this.rules.WedgeOpeningLength/2,q||(xe=be);let Pe=fe.getBottomLineMaxInRange(me,ve);if(Pe>be&&(be=Pe),lexe&&(xe=Pe),xe+=this.rules.WedgeOpeningLength/2,xe+=this.rules.WedgeVerticalMargin),be+=this.rules.WedgeOpeningLength/2,be+=this.rules.WedgeVerticalMargin}else if(he===PlacementEnum.Above){if(U.ParentStaff.ParentInstrument.Staves.length===1)be=this.rules.WedgePlacementAboveY;else{let Pe=0;le>0&&(Pe=le-1);const Ie=oe.StaffLines[Pe];be=-(U.PositionAndShape.RelativePosition.y-Ie.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}be+=this.rules.WedgeOpeningLength/2,q||(xe=be);let Ae=fe.getSkyLineMinInRange(me,ve);if(Ae1&&le>0){const Pe=U.findClosestStaffEntry(me),Ie=U.findClosestStaffEntry(ve);Pe&&Ie&&Pe.parentVerticalContainer}q||(Ae=W.SkyBottomLineCalculator.getSkyLineMinInRange(ye,pe),Ae-j/2?Y=-j/2:Y=K-R.PositionAndShape.BorderMarginBottom}else Y=K-R.PositionAndShape.BorderMarginBottom;R.PositionAndShape.RelativePosition=new PointF2D(F.x,Y)}else if(R.Placement===PlacementEnum.Below){const K=q.getBottomLineMaxInRange(U,W),Z=G.ParentStaff.ParentInstrument.Staves[G.ParentStaff.ParentInstrument.Staves.length-1];if(G.isPartOfMultiStaffInstrument()&&G.ParentStaff!==Z){const Q=G.ParentMusicSystem.StaffLines[G.ParentMusicSystem.StaffLines.indexOf(G)+1].PositionAndShape.RelativePosition.y-G.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,J=R.PositionAndShape.BorderMarginBottom;K+JR.PositionAndShape.Size.width&&(Q=R.PositionAndShape.Size.width-this.rules.MeasureRightMargin,j=Q-K.PositionAndShape.MarginSize.width,F.x=j-K.PositionAndShape.BorderMarginLeft);let J;const te=R.SkyBottomLineCalculator;return U===PlacementEnum.Below?J=te.getBottomLineMaxInRange(j,Q):J=te.getSkyLineMinInRange(j,Q),K.PositionAndShape.RelativePosition=new PointF2D(F.x,J),U===PlacementEnum.Below?te.updateBottomLineInRange(j,Q,K.PositionAndShape.BorderMarginBottom+J):te.updateSkyLineInRange(j,Q,K.PositionAndShape.BorderMarginTop+J),K}calculateTempoExpressionsForMultiTempoExpression(R,F,D,G){metronomeMarks={};const U=Fraction$1.plus(R.AbsoluteTimestamp,F.Timestamp),W=this.graphicalMusicSheet.MeasureList[D];let q=new PointF2D;if(F.ContinuousTempo||F.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!W[0])return;let Y=W[0].ParentStaffLine,K=W[0].PositionAndShape.RelativePosition.x,Z=0;for(let j=0;j0){Y=W[j].ParentStaffLine,K=W[j].PositionAndShape.RelativePosition.x,Z=j;break}if(q=this.getRelativePositionInStaffLineFromTimestamp(U,Z,Y,Y.isPartOfMultiStaffInstrument(),K),F.EntriesList.length>0&&F.EntriesList[0].Expression instanceof InstantaneousTempoExpression){const j=F.EntriesList[0].Expression;if(j.Placement=PlacementEnum.Above,Y.Measures[0].staffEntries.length>0&&Math.abs(q.x-Y.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&Y.ParentMusicSystem===this.musicSystems[0]){const Q=Y.Measures[0].FirstInstructionStaffEntry;if(Q){const J=Q.GraphicalInstructions.last();q.x=J.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(q.x=Y.PositionAndShape.RelativePosition.x+Y.Measures[0].PositionAndShape.RelativePosition.x)}}for(const j of F.EntriesList){let Q=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(Q=TextAlignmentEnum.LeftBottom);const J=this.calculateLabel(Y,q,j.label,F.getFontstyleOfFirstEntry(),j.Expression.Placement,this.rules.UnknownTextHeight,Q);if(j.Expression instanceof InstantaneousTempoExpression){for(const ne of Y.AbstractExpressions)ne instanceof GraphicalInstantaneousTempoExpression&&(ne.SourceExpression.Label,j.Expression.Label);new GraphicalInstantaneousTempoExpression(j.Expression,J).ParentStaffLine||log$2.warn("Adding staffline didn't work"),j.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[D]=j.Expression)}else j.Expression instanceof ContinuousTempoExpression;if(G===R.TempoExpressions.length-1)for(const te of Object.values(metronomeMarks))this.createMetronomeMark(te,D)}}}createMetronomeMark(R,F){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(R){}clearSystemsAndMeasures(){for(let R=0,F=this.graphicalMusicSheet.MusicPages.length;R-1&&Q.PositionAndShape.ChildElements.splice(J,1),Q.FirstInstructionStaffEntry=void 0,Q.beginInstructionsWidth=0}if(Q.LastInstructionStaffEntry){const J=Q.PositionAndShape.ChildElements.indexOf(Q.LastInstructionStaffEntry.PositionAndShape);J>-1&&Q.PositionAndShape.ChildElements.splice(J,1),Q.LastInstructionStaffEntry=void 0,Q.endInstructionsWidth=0}}K.Measures=[],K.PositionAndShape.ChildElements=[]}W.StaffLines.length=0,W.PositionAndShape.ChildElements=[]}D.MusicSystems=[],D.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(R,F,D,G,U,W,q,Y,K,Z=void 0,j=void 0){R.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&R.StemDirectionXml!==void 0?R.WantedStemDirection=R.StemDirectionXml:this.calculateStemDirectionFromVoices(R);const Q=F.findOrCreateGraphicalVoiceEntry(R);Q.octaveShiftValue=Y;const J=F.tabStaffEntry;let te;J&&(te=J.findOrCreateGraphicalVoiceEntry(R));for(let ne=0,ie=R.Notes.length;ne-1)continue;let oe;if(R.IsGrace?oe=MusicSheetCalculator.symbolFactory.createGraceNote(re,Q,U,this.rules,Y):(oe=MusicSheetCalculator.symbolFactory.createNote(re,Q,U,Y,this.rules,void 0),MusicSheetCalculator.stafflineNoteCalculator.trackNote(oe)),re.Pitch&&this.checkNoteForAccidental(oe,D,U,Y),this.resetYPositionForLeadSheet(oe.PositionAndShape),F.addGraphicalNoteToListAtCorrectYPosition(Q,oe),oe.PositionAndShape.calculateBoundingBox(),this.leadSheet||(re.NoteBeam!==void 0&&re.PrintObject&&this.handleBeam(oe,re.NoteBeam,q),re.NoteTuplet!==void 0&&re.PrintObject&&this.handleTuplet(oe,re.NoteTuplet,W)),te){const le=MusicSheetCalculator.symbolFactory.createNote(re,te,U,Y,this.rules,void 0);J.addGraphicalNoteToListAtCorrectYPosition(te,le),le.PositionAndShape.calculateBoundingBox(),this.leadSheet||re.NoteTuplet&&this.handleTuplet(le,re.NoteTuplet,W)}}return R.Articulations.length>0&&this.handleVoiceEntryArticulations(R.Articulations,R,F),R.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(R.TechnicalInstructions,R,F),R.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(R,F,G),R.OrnamentContainer&&this.handleVoiceEntryOrnaments(R.OrnamentContainer,R,F),Y}resetYPositionForLeadSheet(R){this.leadSheet&&(R.RelativePosition=new PointF2D(R.RelativePosition.x,0))}layoutVoiceEntries(R,F){if(R.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet)for(const D of R.graphicalVoiceEntries){const G=D.notes;if(G.length===0)continue;const U=G[0].sourceNote.ParentVoiceEntry,W=G[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(U,G,R,W)}}maxInstrNameLabelLength(){var F;let R=0;for(const D of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if(((F=D.NameLabel)==null?void 0:F.print)&&D.Voices.length>0&&D.Voices[0].Visible){let G=D.NameLabel;this.rules.RenderPartNames||(G=new Label("",G.textAlignment,G.font));const U=new GraphicalLabel(G,this.rules.InstrumentLabelTextHeight,TextAlignmentEnum.LeftCenter,this.rules);U.setLabelPositionAndShapeBorders(),R=Math.max(R,U.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?R:0}calculateSheetLabelBoundingBoxes(){var G;const R=this.graphicalMusicSheet.ParentMusicSheet,F=this.rules.DefaultColorTitle;if(R.Title!==void 0&&this.rules.RenderTitle){const U=new GraphicalLabel(R.Title,this.rules.SheetTitleHeight,TextAlignmentEnum.CenterBottom,this.rules);U.Label.IsCreditLabel=!0,U.Label.colorDefault=F,this.graphicalMusicSheet.Title=U,U.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(R.Subtitle!==void 0&&this.rules.RenderSubtitle){const U=new GraphicalLabel(R.Subtitle,this.rules.SheetSubtitleHeight,TextAlignmentEnum.CenterCenter,this.rules);U.Label.IsCreditLabel=!0,U.Label.colorDefault=F,this.graphicalMusicSheet.Subtitle=U,U.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(R.Composer!==void 0&&this.rules.RenderComposer){const U=new GraphicalLabel(R.Composer,this.rules.SheetComposerHeight,TextAlignmentEnum.RightCenter,this.rules);U.Label.IsCreditLabel=!0,U.Label.colorDefault=F,this.graphicalMusicSheet.Composer=U,U.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(R.Lyricist!==void 0&&this.rules.RenderLyricist){const U=new GraphicalLabel(R.Lyricist,this.rules.SheetAuthorHeight,TextAlignmentEnum.LeftCenter,this.rules);U.Label.IsCreditLabel=!0,U.Label.colorDefault=F,this.graphicalMusicSheet.Lyricist=U,U.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const D=(G=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:G[0];if(D&&D.FirstInstructionsStaffEntries.length>0){const U=D.FirstInstructionsStaffEntries[0];let W,q;for(let Y=0,K=U.Instructions.length;Y0&&Z.graphicalVoiceEntries[0].notes.length===1){const j=Z.graphicalVoiceEntries[0].notes[0];!j.sourceNote.Pitch&&new Fraction$1(1,2).lt(j.sourceNote.Length)&&this.layoutMeasureWithWholeRest(j,Z,K)}}}}}}optimizeRestNotePlacement(R,F){if(R.graphicalVoiceEntries.length===0)return;const D=R.graphicalVoiceEntries[0].notes;if(D.length===0)return;const G=D[0],U=G.sourceNote.isRest();if(R.graphicalVoiceEntries.length===2){let W=!1;const q=R.graphicalVoiceEntries[1].notes;q.length>0&&(W=q[0].sourceNote.isRest()),U&&W?this.calculateTwoRestNotesPlacementWithCollisionDetection(R):(U||W)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(R)}else if(U&&R!==F.staffEntries[0]&&R!==F.staffEntries[F.staffEntries.length-1]){const W=F.staffEntries.indexOf(R),q=F.staffEntries[W-1],Y=F.staffEntries[W+1];if(q.graphicalVoiceEntries.length===1){const K=q.graphicalVoiceEntries[0].notes[0];if(K.sourceNote.NoteBeam!==void 0&&Y.graphicalVoiceEntries.length===1){const Z=Y.graphicalVoiceEntries[0].notes[0];Z.sourceNote.NoteBeam!==void 0&&K.sourceNote.NoteBeam===Z.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(R,G,K,Y,Z),R.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(R,F,D,G,U=0){let W=new PointF2D,q,Y;const K=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,Z=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(R),j=Math.min(Math.floor(Z),K-1),Q=Math.min(Math.ceil(Z),K-1);if(j<0||F<0)return W;if(q=this.getFirstLeftNotNullStaffEntryFromContainer(j,F,G),Y=this.getFirstRightNotNullStaffEntryFromContainer(Q,F,G),q&&Y){let J=q.parentMeasure.PositionAndShape.RelativePosition.x;U>0&&(J=U);let te=q.PositionAndShape.RelativePosition.x+J,ne=Y.PositionAndShape.RelativePosition.x+Y.parentMeasure.PositionAndShape.RelativePosition.x;U>0&&(ne=Y.PositionAndShape.RelativePosition.x+J);let ie=0;if(q!==Y){const re=q.getAbsoluteTimestamp(),oe=Y.getAbsoluteTimestamp();ie=Fraction$1.minus(R,re).RealValue/Fraction$1.minus(oe,re).RealValue}q.parentMeasure.ParentStaffLine!==Y.parentMeasure.ParentStaffLine&&(q.parentMeasure.ParentStaffLine===D?ne=D.PositionAndShape.Size.width:te=D.PositionAndShape.RelativePosition.x),W=new PointF2D(te+(ne-te)*ie,0)}return W}getRelativeXPositionFromTimestamp(R){const F=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,D=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(R),G=Math.max(0,Math.min(Math.round(D),F-1)),U=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[G].getFirstNonNullStaffEntry();return U.PositionAndShape.RelativePosition.x+U.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(R){var W;this.rules.RenderSingleHorizontalStaffline&&(R.PositionAndShape.BorderRight=R.PositionAndShape.Size.width,R.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=R.PositionAndShape.Size.width);let F=10;if(R.MusicSystems.length>0){const q=R.MusicSystems[0];F=q.PositionAndShape.RelativePosition.y+q.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const q=this.graphicalMusicSheet.Title;q.PositionAndShape.Parent=R.PositionAndShape;const Y=new PointF2D;Y.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,Y.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,q.PositionAndShape.RelativePosition=Y,R.Labels.push(q)}if(this.graphicalMusicSheet.Subtitle){const q=this.graphicalMusicSheet.Subtitle;q.PositionAndShape.Parent=R.PositionAndShape;const Y=new PointF2D;Y.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,Y.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,q.PositionAndShape.RelativePosition=Y,R.Labels.push(q)}const D=this.graphicalMusicSheet.Composer;let G;if(D){D.PositionAndShape.Parent=R.PositionAndShape,D.setLabelPositionAndShapeBorders();const q=new PointF2D;q.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,q.y=F,q.y-=this.rules.SystemComposerDistance;const Y=(W=D.TextLines)==null?void 0:W.length;Y>1&&(q.y-=D.PositionAndShape.BorderBottom*(Y-1)/Y),G=q.y,D.PositionAndShape.RelativePosition=q,R.Labels.push(D)}const U=this.graphicalMusicSheet.Lyricist;if(U){U.PositionAndShape.Parent=R.PositionAndShape,U.setLabelPositionAndShapeBorders();const q=new PointF2D;q.x=this.rules.PageLeftMargin,q.y=F,q.y+=U.PositionAndShape.BorderBottom,q.y=Math.min(q.y,G!=null?G:Number.MAX_SAFE_INTEGER),U.PositionAndShape.RelativePosition=q,R.Labels.push(U)}}createGraphicalTies(){for(let R=0;R=0&&this.staffEntriesWithGraphicalTies.push(U)}U=q}}setTieDirections(R){if(!R)return;const F=R.ties;if(F.length>1){let D;for(const G of F){const U=G.Notes[0];(!D||U.Pitch.getHalfTone()>D.Pitch.getHalfTone())&&(D=U)}for(const G of F)G.TieDirection===PlacementEnum.NotYetDefined&&(G.Notes[0]===D?G.TieDirection=PlacementEnum.Above:G.TieDirection=PlacementEnum.Below)}}createAccidentalCalculators(){const R=[],F=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(F)for(let D=0;D1)return;j=MusicSheetCalculator.symbolFactory.createGraphicalMeasure(R,Z)}if(j.hasError=R.getErrorInMeasure(Y),R.FirstInstructionsStaffEntries[Y])for(let le=0,fe=R.FirstInstructionsStaffEntries[Y].Instructions.length;le0){const me=fe.Instructions[0];MusicSheetCalculator.symbolFactory.createInStaffClef(he,me)}this.rules.RenderChordSymbols&&((oe=fe.ChordContainers)==null?void 0:oe.length)>0&&(fe.ParentStaff.ParentInstrument.HasChordSymbols=!0,MusicSheetCalculator.symbolFactory.createChordSymbols(fe,he,G.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(G.doCalculationsAtEndOfMeasure(),R.LastInstructionsStaffEntries[Y]){const le=R.LastInstructionsStaffEntries[Y];for(let fe=0,he=le.Instructions.length;fe=1&&j.staffEntries.length===0){const le=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(j.parentSourceMeasure,j.parentSourceMeasure.AbsoluteTimestamp,j.parentSourceMeasure.CompleteNumberOfStaves),Z),fe=new VoiceEntry(new Fraction$1(0,1),Z.Voices[0],le),he=new Note$1(fe,le,Fraction$1.createFromFraction(R.Duration),void 0,R);he.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,fe.addNote(he);const ge=MusicSheetCalculator.symbolFactory.createStaffEntry(le,j);j.addGraphicalStaffEntry(ge),ge.relInMeasureTimestamp=fe.Timestamp;const ce=MusicSheetCalculator.symbolFactory.createVoiceEntry(fe,ge);ge.graphicalVoiceEntries.push(ce);const me=MusicSheetCalculator.symbolFactory.createNote(he,ce,new ClefInstruction,OctaveEnum.NONE,void 0);MusicSheetCalculator.stafflineNoteCalculator.trackNote(me),ce.notes.push(me)}j.hasOnlyRests=!0;for(const le of j.staffEntries)if(j.hasOnlyRests=le.hasOnlyRests(),!j.hasOnlyRests)break;return j}checkNoteForAccidental(R,F,D,G){let U=R.sourceNote.Pitch;const W=R.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();W!==0&&R.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&(U=R.Transpose(F.ActiveKeyInstruction,D,W,G),R.sourceNote.TransposedPitch=U),R.sourceNote.halfTone=U.getHalfTone(),F.checkAccidental(R,U)}handleStaffEntries(R){for(let F=0,D=this.graphicalMusicSheet.MeasureList.length;F0&&Y.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(Y,U),this.layoutStaffEntry(Y));this.graphicalMeasureCreatedCalculations(q)}}}}calculateSkyBottomLines(){for(const R of this.musicSystems)for(const F of R.StaffLines)F.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let R=0,F=this.musicSystems.length;R0&&this.layoutArticulationMarks(ne.Articulations,ne,Q)}}}}}}calculateOrnaments(){for(let R=0,F=this.musicSystems.length;R0&&G.LyricVersesNumbers.sort()}for(let F=0,D=this.musicSystems.length;F=0&&(G=F.GraphicalLyricsEntries[D+1]),!G)return;const U=R.StaffEntryParent.parentMeasure.ParentStaffLine,W=G.StaffEntryParent.parentMeasure.ParentStaffLine,q=R.StaffEntryParent,Y=G.StaffEntryParent;if(R.StaffEntryParent.parentMeasure.ParentStaffLine===G.StaffEntryParent.parentMeasure.ParentStaffLine){const K=q.parentMeasure.PositionAndShape.RelativePosition.x+q.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=Y.parentMeasure.PositionAndShape.RelativePosition.x+Y.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.RelativePosition.x+G.GraphicalLabel.PositionAndShape.BorderMarginLeft,j=R.GraphicalLabel.PositionAndShape.RelativePosition.y;let Q=1;Z-K>this.rules.MinimumDistanceBetweenDashes*3&&(Q=Math.floor((Z-K)/this.rules.MinimumDistanceBetweenDashes)-1),Q===1?this.calculateSingleDashForLyricWord(U,K,Z,j):this.calculateDashes(U,K,Z,j)}else{const K=q.parentMeasure.PositionAndShape.RelativePosition.x+q.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=U.Measures[U.Measures.length-1],j=Z.PositionAndShape.RelativePosition.x+Z.PositionAndShape.Size.width;let Q=R.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(U,K,j,Q),W&&W.Measures[0]&&Y.parentMeasure.ParentStaffLine&&!(Y===Y.parentMeasure.staffEntries[0]&&Y.parentMeasure===Y.parentMeasure.ParentStaffLine.Measures[0])){const J=W.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,te=Y.parentMeasure.PositionAndShape.RelativePosition.x+Y.PositionAndShape.RelativePosition.x+G.GraphicalLabel.PositionAndShape.BorderMarginLeft;Q=G.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(W,J,te,Q)}}}calculateDashes(R,F,D,G){let U=D-F;if(UF;)U=this.calculateRightAndLeftDashesForLyricWord(R,F,D,G),F+=q,D-=q,Y++;U>q*2&&this.calculateSingleDashForLyricWord(R,F,D,G)}}calculateSingleDashForLyricWord(R,F,D,G){const U=new Label("-"),W=new GraphicalLabel(U,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);W.setLabelPositionAndShapeBorders(),R.LyricsDashes.push(W),this.staffLinesWithLyricWords.indexOf(R)===-1&&this.staffLinesWithLyricWords.push(R),W.PositionAndShape.Parent=R.PositionAndShape;const q=new PointF2D(F+(D-F)/2,G);W.PositionAndShape.RelativePosition=q}calculateLyricExtend(R){let F=R.GraphicalLabel.PositionAndShape.RelativePosition.y;const D=R.StaffEntryParent,G=D.parentMeasure.ParentStaffLine;let U,W;const q=D.parentMeasure.ParentStaff.idInMusicSheet;for(let Y=D.parentVerticalContainer.Index+1;Y0)break;U=K,W=U.parentMeasure.ParentStaffLine,W||(W=D.parentMeasure.ParentStaffLine)}}if(!(!U||!W))if(G===W&&U.parentMeasure.ParentStaffLine){const Y=D.parentMeasure.PositionAndShape.RelativePosition.x+D.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.BorderMarginRight,K=U.parentMeasure.PositionAndShape.RelativePosition.x+U.PositionAndShape.RelativePosition.x+U.PositionAndShape.BorderMarginRight;F-=R.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(G,Y,K,F)}else{const Y=G.Measures[G.Measures.length-1].PositionAndShape,K=D.parentMeasure.PositionAndShape.RelativePosition.x+D.PositionAndShape.RelativePosition.x+R.GraphicalLabel.PositionAndShape.BorderMarginRight,Z=Y.RelativePosition.x+Y.Size.width;if(F-=R.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(G,K,Z,F),!U)return;if(U.parentMeasure.ParentStaffLine&&U.parentMeasure.staffEntries&&!(U===U.parentMeasure.staffEntries[0]&&U.parentMeasure===U.parentMeasure.ParentStaffLine.Measures[0])){const j=W.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,Q=U.parentMeasure.PositionAndShape.RelativePosition.x+U.PositionAndShape.RelativePosition.x+U.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(W,j,Q,F)}}}calculateSingleLyricWordWithUnderscore(R,F,D,G){const U=new PointF2D(F,G),W=new PointF2D(D,G),q=new GraphicalLine(U,W,this.rules.LyricUnderscoreLineWidth);R.LyricLines.push(q),this.staffLinesWithLyricWords.indexOf(R)===-1&&this.staffLinesWithLyricWords.push(R)}calculateRightAndLeftDashesForLyricWord(R,F,D,G){const U=new Label("-"),W=new GraphicalLabel(U,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);W.setLabelPositionAndShapeBorders(),R.LyricsDashes.push(W),this.staffLinesWithLyricWords.indexOf(R)===-1&&this.staffLinesWithLyricWords.push(R),W.PositionAndShape.Parent=R.PositionAndShape;const q=new PointF2D(F,G);W.PositionAndShape.RelativePosition=q;const Y=new Label("-"),K=new GraphicalLabel(Y,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);K.setLabelPositionAndShapeBorders(),R.LyricsDashes.push(K),K.PositionAndShape.Parent=R.PositionAndShape;const Z=new PointF2D(D,G);return K.PositionAndShape.RelativePosition=Z,K.PositionAndShape.RelativePosition.x-W.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const R=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),F=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let D=F;D<=R;D++){const G=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[D];this.dynamicExpressionMap.clear();for(let U=0;U=0;W--)if((U=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[W])!=null&&U.StaffEntries[F])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[W].StaffEntries[F]}getFirstRightNotNullStaffEntryFromContainer(R,F,D){var G,U;if((G=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[R])!=null&&G.StaffEntries[F])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[R].StaffEntries[F];for(let W=R+1;W0||F.StaffLinkedExpressions[D][G].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(F.StaffLinkedExpressions[D][G],R,D)}}calculateStemDirectionFromVoices(R){if(R.ParentSourceStaffEntry.Link!==void 0)if(R===R.ParentSourceStaffEntry.VoiceEntries[0]){R.WantedStemDirection=StemDirectionType.Up;return}else{R.WantedStemDirection=StemDirectionType.Down;return}else R.ParentVoice instanceof LinkedVoice?R.WantedStemDirection=StemDirectionType.Down:R.ParentSourceStaffEntry.VoiceEntries.length>1&&(R.WantedStemDirection=StemDirectionType.Up)}setBeamNotesWantedStemDirections(R){if(!(R.Notes.length>0))return;const F=R.Notes[0].NoteBeam;if(F){for(const D of F.Notes)if(D.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&D.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===R.ParentSourceStaffEntry.ParentStaff.Id){R.WantedStemDirection=D.ParentVoiceEntry.WantedStemDirection;break}}}}class ChordSymbolContainer{constructor(R,F,D,G,U){this.rootPitch=R,this.chordKind=F,this.bassPitch=D,this.degrees=G,this.rules=U}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(R,F,D){let G=R.RootPitch;if(MusicSheetCalculator.transposeCalculator&&(G=MusicSheetCalculator.transposeCalculator.transposePitch(R.RootPitch,D,F)),R.ChordKind===ChordSymbolEnum.none)return R.getTextFromChordKindEnum(R.ChordKind);let U=Pitch.getNoteEnumString(G.FundamentalNote);G.Accidental!==AccidentalEnum.NONE&&(U+=this.getTextForAccidental(G.Accidental));const W={adds:[],alts:[],subs:[]};for(const Z of R.ChordDegrees)if(Z){let j="";switch(Z.alteration!==AccidentalEnum.NONE&&(j+=this.getTextForAccidental(Z.alteration)),j+=Z.value,Z.text){case ChordDegreeText.add:W.adds.push(j);break;case ChordDegreeText.alter:W.alts.push(j);break;case ChordDegreeText.subtract:W.subs.push(j);break}}let q=R.getTextFromChordKindEnum(R.ChordKind);const Y=["adds","alts","subs"],K=R.rules.CustomChords;for(const Z of K){if(Z.chordKind!==R.chordKind)continue;let j=!0;for(const Q of Y){for(const J of Z.degrees[Q]||[])if(W[Q].indexOf(J)<0){j=!1;break}if(!j)break}if(j){for(const Q of Y)for(const J of Z.degrees[Q]||[])W[Q].splice(W[Q].indexOf(J),1);q=Z.alternateName}}if(U+=q,W.adds.length>0&&(U+="("+W.adds.join(",")+")"),W.alts.length>0&&(U+="(alt "+W.alts.join(",")+")"),W.subs.length>0&&(U+="(omit "+W.subs.join(",")+")"),R.BassPitch){let Z=R.BassPitch;MusicSheetCalculator.transposeCalculator&&(Z=MusicSheetCalculator.transposeCalculator.transposePitch(R.BassPitch,D,F)),U+="/",U+=Pitch.getNoteEnumString(Z.FundamentalNote),U+=this.getTextForAccidental(Z.Accidental)}return U}static getTextForAccidental(R){let F="";switch(R){case AccidentalEnum.DOUBLEFLAT:F+="bb";break;case AccidentalEnum.FLAT:F+="b";break;case AccidentalEnum.SHARP:F+="#";break;case AccidentalEnum.DOUBLESHARP:F+="x";break}return F}getTextFromChordKindEnum(R){var F;return(F=this.rules.ChordSymbolLabelTexts.getValue(R))!=null?F:""}}class Degree{constructor(R,F,D){this.value=R,this.alteration=F,this.text=D}}class CustomChord{constructor(R,F,D){this.alternateName=R,this.chordKind=F,this.degrees=D}static createCustomChord(R,F,D){return new CustomChord(R,F,D)}static renameCustomChord(R,F,D){for(const G of D)G.alternateName===R&&(G.alternateName=F)}}var ChordDegreeText=(B=>(B[B.add=0]="add",B[B.alter=1]="alter",B[B.subtract=2]="subtract",B))(ChordDegreeText||{}),ChordSymbolEnum=(B=>(B[B.major=0]="major",B[B.minor=1]="minor",B[B.augmented=2]="augmented",B[B.diminished=3]="diminished",B[B.dominant=4]="dominant",B[B.majorseventh=5]="majorseventh",B[B.minorseventh=6]="minorseventh",B[B.diminishedseventh=7]="diminishedseventh",B[B.augmentedseventh=8]="augmentedseventh",B[B.halfdiminished=9]="halfdiminished",B[B.majorminor=10]="majorminor",B[B.majorsixth=11]="majorsixth",B[B.minorsixth=12]="minorsixth",B[B.dominantninth=13]="dominantninth",B[B.majorninth=14]="majorninth",B[B.minorninth=15]="minorninth",B[B.dominant11th=16]="dominant11th",B[B.major11th=17]="major11th",B[B.minor11th=18]="minor11th",B[B.dominant13th=19]="dominant13th",B[B.major13th=20]="major13th",B[B.minor13th=21]="minor13th",B[B.suspendedsecond=22]="suspendedsecond",B[B.suspendedfourth=23]="suspendedfourth",B[B.Neapolitan=24]="Neapolitan",B[B.Italian=25]="Italian",B[B.French=26]="French",B[B.German=27]="German",B[B.pedal=28]="pedal",B[B.power=29]="power",B[B.Tristan=30]="Tristan",B[B.none=31]="none",B))(ChordSymbolEnum||{});class GraphicalNote extends GraphicalObject{constructor(R,F,D,G=void 0){super(),this.DrawnAccidental=AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=R,this.parentVoiceEntry=F,this.PositionAndShape=new BoundingBox$2(this,F.PositionAndShape),G?this.graphicalNoteLength=G:this.graphicalNoteLength=R.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=D,this.rules.addGraphicalNoteToNoteMap(R,this)}Transpose(R,F,D,G){let U=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(U=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,R,D)),U}calculateNumberOfNeededDots(R){return!this.sourceNote||!this.sourceNote.NoteTuplet?R.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(R,F){return F.NoteToGraphicalNoteMap.getValue(R.NoteToGraphicalNoteObjectId)}}const _EngravingRules=class{constructor(){this.DYSlursStartingAtSameStaffEntryYOffset=0,this.DYMinNoteWidth=0,this.DYWorkId=0,this.DYWorkSpecial=!1,this.DYContainerId="osmdCanvasPage",this.DYSVGContainerId="osmdSvgPage",this.DYMusicScoreType="staff",this.NoteDistances=[1,1,1.3,1.6,2,2.5,3,4],this.NoteDistancesScalingFactors=[1,2,4,8,16,32,64,128],this.DurationDistanceDict={},this.DurationScalingDistanceDict={},this.NoteToGraphicalNoteMapObjectCount=0,this.PlayAlreadyStartedNotesFromCursorPosition=!1,this.PlaybackSkipNotesSafetyInterval=.02,this.UseDefaultVoiceInteractionListener=!0,this.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=_EngravingRules.unit*3,this.MpatMode=!0,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=PagePlacementEnum.Down,this.PageHeight=100001,this.PageTopMargin=5,this.PageTopMarginNarrow=0,this.PageBottomMargin=5,this.PageLeftMargin=5,this.PageRightMargin=5,this.TitleTopDistance=5,this.TitleBottomDistance=1,this.StaffDistance=7,this.BetweenStaffDistance=5,this.MinimumStaffLineDistance=4,this.MinSkyBottomDistBetweenStaves=1,this.StaffHeight=4,this.TabStaffInterlineHeight=1.1111,this.BetweenStaffLinesDistance=_EngravingRules.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.AutoBeamTabs=!1,this.BeamWidth=_EngravingRules.unit/2,this.BeamSpaceWidth=_EngravingRules.unit/3,this.BeamForwardLength=1.25*_EngravingRules.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.BetweenKeySymbolsDistance=.2,this.KeyRightMargin=.75,this.RhythmRightMargin=1.25,this.ShowRhythmAgainAfterPartEndOrFinalBarline=!0,this.NewPartAndSystemAfterFinalBarline=!1,this.InStaffClefScalingFactor=.8,this.DistanceBetweenNaturalAndSymbolWhenCancelling=.4,this.NoteHelperLinesOffset=.25,this.MeasureLeftMargin=.7,this.MeasureRightMargin=0,this.DistanceBetweenLastInstructionAndRepetitionBarline=1,this.ArpeggioDistance=.6,this.StaccatoShorteningFactor=2,this.IdealStemLength=3,this.StemNoteHeadBorderYOffset=.2,this.StemMargin=.2,this.StemMinLength=2.5,this.StemMaxLength=4.5,this.BeamSlopeMaxAngle=10,this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine=1,this.SetWantedStemDirectionByXml=!0,this.GraceNoteScalingFactor=.6,this.GraceNoteXOffset=.2,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=TextAlignmentEnum.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolLabelTexts=new Dictionary,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*_EngravingRules.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*_EngravingRules.unit,this.TupletNumberYOffset=.5,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!1,this.SlurPlacementFromXML=!0,this.BezierCurveStepSize=1e3,this.calculateCurveParametersArrays(),this.TieGhostObjectWidth=.75,this.TieYPositionOffsetFactor=.3,this.MinimumNeededXspaceForTieGhostObject=1,this.TieHeightMinimum=.28,this.TieHeightMaximum=1.2,this.TieHeightInterpolationK=.0288,this.TieHeightInterpolationD=.136,this.SlurNoteHeadYOffset=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.SlurMaximumYControlPointDistance=void 0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=TextAlignmentEnum.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.StemWidth=.15,this.StaffLineWidth=.1,this.StaffLineColor=void 0,this.LedgerLineWidth=1,this.LedgerLineStrokeStyle=void 0,this.LedgerLineColorDefault="#000000",this.WedgeLineWidth=.12,this.TupletLineWidth=.12,this.LyricUnderscoreLineWidth=.12,this.SystemThinLineWidth=.12,this.SystemBoldLineWidth=_EngravingRules.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=_EngravingRules.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=_EngravingRules.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.DisplacedNoteMargin=.1,this.MinNoteDistance=2,this.SubMeasureXSpacingThreshold=35,this.MeasureDynamicsMaxScalingFactor=2.5,this.WholeRestXShiftVexflow=-1.5,this.MetronomeMarksDrawn=!0,this.MetronomeMarkXShift=-6,this.MetronomeMarkYShift=-.5,this.SoftmaxFactorVexFlow=15,this.StaggerSameWholeNotes=!0,this.AlignRests=AlignRestOption.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=FontStyles.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMutipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=PlacementEnum.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,_EngravingRules.FixStafflineBoundingBox=!1,this.PageFormat=PageFormat.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.PerformanceMode=!1,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(B){log$2.info("EngravingRules()",B)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}applyDefaultColorMusic(B){this.DefaultColorMusic=B,this.DefaultColorNotehead=this.DefaultColorMusic,this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.LedgerLineColorDefault=this.DefaultColorNotehead}addGraphicalNoteToNoteMap(B,R){B.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(B.NoteToGraphicalNoteObjectId,R),this.NoteToGraphicalNoteMapObjectCount++}GNote(B){return GraphicalNote.FromNote(B,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(B,R){this.ChordSymbolLabelTexts.setValue(B,R)}resetChordSymbolLabelTexts(B){return B.setValue(ChordSymbolEnum.minor,"m"),B.setValue(ChordSymbolEnum.augmented,"aug"),B.setValue(ChordSymbolEnum.diminished,"dim"),B.setValue(ChordSymbolEnum.dominant,"7"),B.setValue(ChordSymbolEnum.majorseventh,"maj7"),B.setValue(ChordSymbolEnum.minorseventh,"m7"),B.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),B.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),B.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),B.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),B.setValue(ChordSymbolEnum.majorsixth,"maj6"),B.setValue(ChordSymbolEnum.minorsixth,"m6"),B.setValue(ChordSymbolEnum.dominantninth,"9"),B.setValue(ChordSymbolEnum.majorninth,"maj9"),B.setValue(ChordSymbolEnum.minorninth,"m9"),B.setValue(ChordSymbolEnum.dominant11th,"11"),B.setValue(ChordSymbolEnum.major11th,"maj11"),B.setValue(ChordSymbolEnum.minor11th,"m11"),B.setValue(ChordSymbolEnum.dominant13th,"13"),B.setValue(ChordSymbolEnum.major13th,"maj13"),B.setValue(ChordSymbolEnum.minor13th,"m13"),B.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),B.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),B.setValue(ChordSymbolEnum.power,"5"),B.setValue(ChordSymbolEnum.none,"N.C."),B}addChordName(B,R,F,D,G){if(ChordSymbolEnum[R]!==void 0){const U={adds:F,alts:D,subs:G};this.CustomChords.push(CustomChord.createCustomChord(B,ChordSymbolEnum[R],U))}}renameChord(B,R){CustomChord.renameCustomChord(B,R,this.CustomChords)}resetChordNames(){this.addChordName("alt","major",["#5","b9","#9"],["b5"],[]),this.addChordName("7alt","dominant",["#5","b9","#9"],["b5"],[]),this.addChordName("7sus4","dominant",["4"],[],["3"]),this.addChordName("7sus4","suspendedfourth",["7"],[],[]),this.addChordName("9sus4","dominantninth",["4"],[],["3"]),this.addChordName("9sus4","suspendedfourth",["9"],[],[]),this.addChordName("11sus4","dominant11th",["4"],[],["3"]),this.addChordName("11sus4","suspendedfourth",["11"],[],[]),this.addChordName("13sus4","dominant13th",["4"],[],["3"]),this.addChordName("13sus4","suspendedfourth",["13"],[],[]),this.addChordName("7sus2","dominant",["2"],[],["3"]),this.addChordName("7sus2","suspendedsecond",["7"],[],[]),this.addChordName("m7b5","minorseventh",[],["b5"],[]),this.addChordName("9sus2","dominantninth",["2"],[],["3"]),this.addChordName("9sus2","suspendedsecond",["9"],[],[]),this.addChordName("11sus2","dominant11th",["2"],[],["3"]),this.addChordName("11sus2","suspendedsecond",["11"],[],[]),this.addChordName("13sus2","dominant13th",["2"],[],["3"]),this.addChordName("13sus2","suspendedsecond",["13"],[],[]),this.addChordName("m(maj9)","majorminor",["9"],[],[]),this.addChordName("m(maj11)","majorminor",["11"],[],[]),this.addChordName("m(maj13)","majorminor",["13"],[],[]),this.addChordName("69","majorsixth",["9"],[],[]),this.addChordName("mi69","minorsixth",["9"],[],[])}calculateCurveParametersArrays(){this.TPower3=new Array(this.BezierCurveStepSize),this.OneMinusTPower3=new Array(this.BezierCurveStepSize),this.FactorOne=new Array(this.BezierCurveStepSize),this.FactorTwo=new Array(this.BezierCurveStepSize);for(let B=0;B(B[B.XML=0]="XML",B[B.AutoColoring=1]="AutoColoring",B[B.CustomColorSet=2]="CustomColorSet",B))(ColoringModes||{}),DrawingParametersEnum=(B=>(B.allon="allon",B.compact="compact",B.compacttight="compacttight",B.default="default",B.leadsheet="leadsheet",B.preview="preview",B.thumbnail="thumbnail",B))(DrawingParametersEnum||{});class DrawingParameters{constructor(R="default"){this.rules=new EngravingRules,this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=PlacementEnum.Left,this.drawHiddenNotes=!1,this.DrawingParametersEnum=R}set DrawingParametersEnum(R){switch(this.drawingParametersEnum=R,R){case"allon":this.setForAllOn();break;case"thumbnail":this.setForThumbnail();break;case"leadsheet":this.setForLeadsheet();break;case"compact":this.setForCompactMode();break;case"compacttight":this.setForCompactTightMode();break;case"default":default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(R){this.drawCredits=R,this.DrawComposer=R,this.DrawTitle=R,this.DrawSubtitle=R,this.DrawLyricist=R}get DrawTitle(){return this.drawTitle}set DrawTitle(R){this.drawTitle=R,this.rules.RenderTitle=R,R||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(R){this.drawSubtitle=R,this.rules.RenderSubtitle=R,R&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(R){this.drawComposer=R,this.rules.RenderComposer=R}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(R){this.drawLyricist=R,this.rules.RenderLyricist=R}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(R){this.drawPartNames=R,this.rules.RenderPartNames=R,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(R){this.fingeringPosition=R,this.rules.FingeringPosition=R}get Rules(){return this.rules}set Rules(R){this.rules=R}}var AlignRestOption=(B=>(B[B.Never=0]="Never",B[B.Always=1]="Always",B[B.Auto=2]="Auto",B))(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=(B=>(B[B.No=0]="No",B[B.YesVisible=1]="YesVisible",B[B.YesInvisible=2]="YesInvisible",B))(FillEmptyMeasuresWithWholeRests||{}),BackendType=(B=>(B[B.SVG=0]="SVG",B[B.Canvas=1]="Canvas",B))(BackendType||{});class OSMDOptions{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:DrawingParametersEnum.default}}static BackendTypeFromString(R){return R&&R.toLowerCase()==="canvas"?1:0}}class IXmlElement{constructor(R){if(this.hasAttributes=!1,!R)throw new Error("IXmlElement: expected Element, got undefined");this.elem=R,this.name=R.nodeName.toLowerCase(),R.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=R.attributes[0]),this.hasElements=R.hasChildNodes(),R.childNodes.length===1&&R.childNodes[0].nodeType===Node.TEXT_NODE?this.value=R.childNodes[0].nodeValue:this.value=""}attribute(R){return this.elem.attributes.getNamedItem(R)}attributes(){if(!this.attrs){const R=this.elem.attributes,F=[];for(let D=0;D0?this.Voices[0].Visible:!1}set Visible(R){for(let F=0,D=this.Voices.length;F-1&&this.parent.MusicSystems.splice(F,1)}this.parent=R,this.boundingBox.Parent=R.PositionAndShape}get NextSystem(){const R=this.Parent.MusicSystems.indexOf(this);return R!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[R+1]:void 0}get StaffLines(){return this.staffLines}get GraphicalMeasures(){return this.graphicalMeasures}get MeasureNumberLabels(){return this.measureNumberLabels}get Labels(){return this.labels.values()}get ObjectsToRedraw(){return this.objectsToRedraw}get InstrumentBrackets(){return this.instrumentBrackets}get GroupBrackets(){return this.groupBrackets}get GraphicalMarkedAreas(){return this.graphicalMarkedAreas}get SystemLines(){return this.systemLines}get Id(){return this.id}createSystemLeftLine(R,F,D){let G=-R/2;D&&(G=this.maxLabelLength+F-R/2);const U=this.staffLines[0].Measures[0];let W;this.staffLines.length>1&&(W=this.staffLines[this.staffLines.length-1].Measures[0]);const q=this.createSystemLine(G,R,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,U,W);this.SystemLines.push(q),q.PositionAndShape.RelativePosition=new PointF2D(G,0),q.PositionAndShape.BorderLeft=0,q.PositionAndShape.BorderRight=R,q.PositionAndShape.BorderTop=0,q.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(q)}createVerticalLineForMeasure(R,F,D,G,U,W){const q=W.ParentStaffLine,Y=new PointF2D(q.PositionAndShape.RelativePosition.x,q.PositionAndShape.RelativePosition.y),K=q.ParentStaff.ParentInstrument.Staves;if(q.ParentStaff===K[0]){let Z;K.length>1&&(Z=this.getBottomStaffLine(q).Measures[U]);const j=this.createSystemLine(R,F,D,G,this,W,Z),Q=Y.x+R;j.PositionAndShape.RelativePosition=new PointF2D(Q,0),j.PositionAndShape.BorderLeft=0,j.PositionAndShape.BorderRight=F,this.SystemLines.push(j)}}setYPositionsToVerticalLineObjectsAndCreateLines(R){}calculateBorders(R){}alignBeginInstructions(){}GetLeftBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}GetRightBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}AddGraphicalMeasures(R){for(let F=0,D=R.length;F1){let W,q;for(let Y=0,K=this.staffLines.length;Ythis.maxLabelLength&&(this.maxLabelLength=Z.PositionAndShape.Size.width,F=U)}this.updateMusicSystemStaffLineXPosition(F)}setMusicSystemLabelsYPosition(){this.labels.forEach((R,F)=>{let D=0,G=0;for(let U=0;U0&&(F.PositionAndShape.RelativePosition=new PointF2D(0,D/G+2))})}checkStaffEntriesForStaffEntryLink(){let R=!1,F=!1;for(let D=0;D=0;D--){if(F=R.InstrumentalGroups[D],F instanceof Instrument){if(F.Visible===!0)return F;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(F)}}updateMusicSystemStaffLineXPosition(R){for(let F=0,D=this.StaffLines.length;F1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let R=new Fraction$1(0,1);const F=[];for(let D=0,G=this.staffEntries.length;D0&&W.Add(Y.notes[0].graphicalNoteLength);R.lt(W)&&(R=Fraction$1.createFromFraction(W))}return R}addGraphicalStaffEntry(R){this.staffEntries.push(R)}addGraphicalStaffEntryAtTimestamp(R){if(R)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(R.relInMeasureTimestamp))this.staffEntries.push(R);else for(let F=this.staffEntries.length-1;F>=0;F--){if(this.staffEntries[F].relInMeasureTimestamp.lt(R.relInMeasureTimestamp)){this.staffEntries.splice(F+1,0,R);break}F===0&&this.staffEntries.splice(F,0,R)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!0:this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!1:this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const R=this.parentSourceMeasure;return R?R.beginsWithLineRepetition():!1}endsWithLineRepetition(){const R=this.parentSourceMeasure;return R?R.endsWithLineRepetition():!1}beginsWithWordRepetition(){const R=this.parentSourceMeasure;return R?R.beginsWithWordRepetition():!1}endsWithWordRepetition(){const R=this.parentSourceMeasure;return R?R.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}Vex.Flow;class VexFlowVoiceEntry extends GraphicalVoiceEntry{constructor(R,F){super(R,F)}applyBordersFromVexflow(){const R=this.vfStaveNote;if(!R.getNoteHeadBeginX)return;const F=R.getBoundingBox(),D=R.getNoteHeadBeginX()-F.x;this.PositionAndShape.RelativePosition.y=F.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=F.h/unitInPixels,this.PositionAndShape.BorderLeft=-(D+R.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(F.w-D)/unitInPixels}set vfStaveNote(R){this.mVexFlowStaveNote=R}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var Q;const R=this.rules.DefaultColorNotehead,F=this.rules.DefaultColorRest,D=this.rules.DefaultColorStem,G="#00000000";let U,W;const q=this.vfStaveNote;for(let J=0;JY.symbol_type===F))return;const q=new VF$9.Repetition(F,G,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(q,D);return}this.addVolta(R)}addVolta(R){var D;let F=VF$9.Volta.type.BEGIN;if(R.type===RepetitionInstructionEnum.Ending){switch(R.alignment){case AlignmentType.Begin:this.parentSourceMeasure.endsRepetitionEnding()?F=VF$9.Volta.type.BEGIN_END:F=VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;F=VF$9.Volta.type.END;break}const G=this.ParentStaffLine.SkyBottomLineCalculator,U=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,W=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,U+.4),q=G.getSkyLineMinInRange(U,W)-2;let Y=-6.1+this.rules.VoltaOffset,K=this.rules.VoltaOffset;q0){log$2.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const j=this.createGhostGves(Z);D.splice(W,0,...j),W+=j.length}}else{const Z=Fraction$1.minus(Y,this.parentSourceMeasure.AbsoluteTimestamp);if(Z.RealValue>0){log$2.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const j=this.createGhostGves(Z);D.splice(0,0,...j),W+=j.length}}F=K}const G=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),U=Fraction$1.minus(G,F);if(U.RealValue>0){log$2.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const W=this.createGhostGves(U);D=D.concat(W)}return D}createGhostGves(R){const F=VexFlowConverter.GhostNotes(R),D=[];for(const G of F){const U=new VexFlowVoiceEntry(void 0,void 0);U.vfStaveNote=G,D.push(U)}return D}handleBeam(R,F){const D=R.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let G=this.beams[D];G||(G=this.beams[D]=[]);let U;for(const q of G)q[0]===F&&(U=q);U||(U=[F,[]],G.push(U));const W=R.parentVoiceEntry;U[1].indexOf(W)<0&&U[1].push(W)}handleTuplet(R,F){const D=R.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;F=R.sourceNote.NoteTuplet;let G=this.tuplets[D];G||(G=this.tuplets[D]=[]);let U;for(const q of G)q[0]===F&&(U=q);U||(U=[F,[]],G.push(U));const W=R.parentVoiceEntry;U[1].indexOf(W)<0&&U[1].push(W)}finalizeBeams(){this.vfbeams={};const R=[];for(const F in this.beams)if(this.beams.hasOwnProperty(F)){let D=this.vfbeams[F];D||(D=this.vfbeams[F]=[]);for(const G of this.beams[F]){let U=!1;for(const J of G[0].Notes)if(J.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!J.TypeLength||J.TypeLength.RealValue>.125)){U=!0;break}if(U){log$2.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const W=[],q=G[0],Y=G[1];let K=!0;for(const J of Y)J.parentVoiceEntry.ParentVoice===q.Notes[0].ParentVoiceEntry.ParentVoice&&(K=J.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined);let Z=!1,j;const Q=[];for(const J of Y){const te=J.vfStaveNote;te&&(W.push(te),R.push(te)),J.parentVoiceEntry.IsGrace&&(Z=!0),J.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&Q.push(J.parentVoiceEntry.StemColor)}if(W.length>1){const J=new VF$9.Beam(W,K);if(Z&&(J.render_options.beam_width=3,J.render_options.partial_beam_length=4),Q.length>=2&&this.rules.ColorBeams){j=Q[0];for(const te of Q)if(te!==j){j=void 0;break}J.setStyle({fillStyle:j,strokeStyle:j})}this.rules.FlatBeams&&(J.render_options.flat_beams=!0,J.render_options.flat_beam_offset=this.rules.FlatBeamOffset,J.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),D.push(J)}else log$2.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(R)}autoBeamNotes(R){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let F=[],D=[],G,U=[];this.autoTupletVfBeams=[];const W=[];this.autoVfBeams=[];let q=this.parentSourceMeasure.ActiveTimeSignature;q||(q=this.parentSourceMeasure.Duration);for(const Z of this.staffEntries)for(const j of Z.graphicalVoiceEntries){const Q=j.vfStaveNote,J=j.notes[0],te=Z.relInMeasureTimestamp.isOnBeat(q),ne=D.length>=2,ie=J.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,re=j.parentVoiceEntry.IsGrace||ie||R.contains(Q);if(re||te){if(ne){for(const le of D)F.push(le);W.push(F.slice()),F=[]}if(D=[],re)continue}const oe=j.notes[0].sourceNote.NoteTuplet;if(oe){let le=!1;for(const fe of oe.Notes){for(const he of fe)if(he.NoteTypeXml>=NoteType.QUARTER||he.ParentVoiceEntry.IsGrace||he.isRest()&&!this.rules.AutoBeamOptions.beam_rests){le=!0;break}if(le)break}if(!G)G=oe;else if(G!==oe){if(U.length>1){const fe=new VF$9.Beam(U,!0);this.rules.FlatBeams&&(fe.render_options.flat_beams=!0,fe.render_options.flat_beam_offset=this.rules.FlatBeamOffset,fe.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(fe)}U=[],G=oe}le||U.push(Q);continue}else G=void 0;D.push(Q)}if(U.length>=2){const Z=new VF$9.Beam(U,!0);this.rules.FlatBeams&&(Z.render_options.flat_beams=!0,Z.render_options.flat_beam_offset=this.rules.FlatBeamOffset,Z.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(Z)}if(D.length>=2){for(const Z of D)F.push(Z);W.push(F)}const Y=this.rules.AutoBeamOptions,K={beam_middle_only:Y.beam_middle_rests_only,beam_rests:Y.beam_rests,maintain_stem_directions:Y.maintain_stem_directions};if(Y.groups&&Y.groups.length){const Z=[];for(const j of Y.groups)Z.push(new VF$9.Fraction(j[0],j[1]));K.groups=Z}for(const Z of W){const j=VF$9.Beam.generateBeams(Z,K);for(const Q of j)this.rules.FlatBeams&&(Q.render_options.flat_beams=!0,Q.render_options.flat_beam_offset=this.rules.FlatBeamOffset,Q.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(Q)}}finalizeTuplets(){this.vftuplets={};for(const R in this.tuplets)if(this.tuplets.hasOwnProperty(R)){let F=this.vftuplets[R];F||(F=this.vftuplets[R]=[]);for(const D of this.tuplets[R]){const G=[],U=D[1];for(const W of U)G.push(W.vfStaveNote);if(G.length>1){const W=D[0],q=W.Notes[0][0].NormalNotes,Y=W.Bracket||W.TupletLabelNumber===3&&this.rules.TripletsBracketed||W.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let K=VF$9.Tuplet.LOCATION_TOP;W.tupletLabelNumberPlacement===PlacementEnum.Below&&(K=VF$9.Tuplet.LOCATION_BOTTOM),F.push(new VF$9.Tuplet(G,{bracketed:Y,location:K,notes_occupied:q,num_notes:W.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else log$2.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(R){}graphicalMeasureCreatedCalculations(){let R,F=[];const D=[];for(const U of this.staffEntries){R=!1,F=[];for(const W of U.graphicalVoiceEntries){if(W.parentVoiceEntry.IsGrace){F.push(W),D.push(W),R||(R=W.parentVoiceEntry.GraceSlur);continue}if(W.vfStaveNote=VexFlowConverter.StaveNote(W),F.length>0){const q=[];for(let K=0;K0&&(Z.GraceSlash=!1);const j=VexFlowConverter.StaveNote(Z);Z.vfStaveNote=j,q.push(j)}const Y=new VF$9.GraceNoteGroup(q,R);W.vfStaveNote.addModifier(0,Y),F=[]}}}if(F.length>0)for(const U of F)U.vfStaveNote=VexFlowConverter.StaveNote(U),U.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const G=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const U of this.staffEntries)U.setModifierXOffsets();for(const U of G){if(!U)continue;this.vfVoices[U.VoiceId]=new VF$9.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:VF$9.RESOLUTION}).setMode(VF$9.Voice.Mode.SOFT);const W=this.getRestFilledVexFlowStaveNotesPerVoice(U);for(const q of W){if(q.parentVoiceEntry&&q.parentVoiceEntry.IsGrace&&!q.parentVoiceEntry.GraceAfterMainNote)continue;const Y=q;if(Y.vfStaveNote.ticks.denominator===0)continue;if(q.notes.length===0||!q.notes[0]||!q.notes[0].sourceNote.PrintObject){this.vfVoices[U.VoiceId].addTickable(Y.vfStaveNote);continue}const K=Y.parentStaffEntry;if(K&&K.vfClefBefore){const Z=new NoteSubGroup([K.vfClefBefore]);Y.vfStaveNote.getCategory&&Y.vfStaveNote.getCategory()==="stavenotes"&&Y.vfStaveNote.addModifier(0,Z)}q.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===PlacementEnum.Left||this.rules.FingeringPosition===PlacementEnum.Right)&&this.createFingerings(q),this.createStringNumber(q)),this.createArpeggio(q),this.vfVoices[U.VoiceId].addTickable(Y.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const U of D)this.createFingerings(U),this.createStringNumber(U),this.createArpeggio(U);this.createArticulations(),this.createOrnaments()}createArpeggio(R){if(R.parentVoiceEntry&&R.parentVoiceEntry.Arpeggio){const F=R.parentVoiceEntry.Arpeggio;if(R.notes&&R.notes.length>1){const D=VexFlowConverter.StrokeTypeFromArpeggioType(F.type),G=new VF$9.Stroke(D,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&R.vfStaveNote.addStroke(0,G)}else log$2.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(const R of this.staffEntries)for(const F of R.graphicalVoiceEntries)for(const D of F.notes){const G=D.vfnote;if(!G||!G[0])continue;switch(G[0].getStemDirection()){case VF$9.Stem.UP:F.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:F.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}}createArticulations(){for(let R=0,F=this.staffEntries.length;R1||R.parentStaffEntry.graphicalVoiceEntries.length>1?K=VF$9.StaveModifier.Position.LEFT:j.idInMusicSheet===0?(K=VF$9.StaveModifier.Position.ABOVE,q=PlacementEnum.Above):(K=VF$9.StaveModifier.Position.BELOW,q=PlacementEnum.Below)}const Z=new VF$9.FretHandFinger(W.value);if(Z.setPosition(K),Z.setOffsetX(Y),q===PlacementEnum.Above||q===PlacementEnum.Below){const j=q===PlacementEnum.Above?-1:1,Q=q===PlacementEnum.Above?G:D-1-G;if(this.rules.FingeringInsideStafflines&&D>1){const J=Z.getWidth()/2,te=D*2.5;Z.setOffsetY(j*(Q+te)*J)}else if(!this.rules.FingeringInsideStafflines){const J=new VF$9.StringNumber(W.value);J.radius=0,J.setPosition(K),J.setOffsetY(j*Q*J.getWidth()*2/3),F.vfStaveNote.addModifier(G,J);continue}}F.vfStaveNote.addModifier(G,Z)}}createStringNumber(R){if(!this.rules.RenderStringNumbersClassical)return;const F=R;R.notes.forEach((D,G)=>{const U=D.sourceNote.StringInstruction;if(U){let W=U.value;switch(W){case"1":W="I";break;case"2":W="II";break;case"3":W="III";break;case"4":W="IV";break;case"5":W="V";break;case"6":W="VI";break}const q=new VF$9.StringNumber(W);q.radius=0;const Y=-this.rules.StringNumberOffsetY;R.notes.length>1||R.parentStaffEntry.graphicalVoiceEntries.length>1?(q.setOffsetX(D.baseStringNumberXOffset*13),q.setPosition(VF$9.Modifier.Position.RIGHT)):q.setPosition(VF$9.Modifier.Position.ABOVE),q.setOffsetY(Y),F.vfStaveNote.addModifier(G,q)}})}lineTo(R,F){const D=new VF$9.StaveConnector(R.getVFStave(),this.stave);D.setType(F),this.connectors.push(D)}getVFStave(){return this.stave}updateInstructionWidth(){let R=0,F=0;const D=this.stave.getModifiers();for(const G of D)G.getPosition()===StavePositionEnum.BEGIN?R+=G.getWidth()+G.getPadding(void 0):G.getPosition()===StavePositionEnum.END&&(F+=G.getWidth()+G.getPadding(void 0));this.beginInstructionsWidth=(R!=null?R:0)/unitInPixels,this.endInstructionsWidth=(F!=null?F:0)/unitInPixels}addStaveTie(R,F){this.vfTies.push(R),F.vfTie=R}}var StavePositionEnum=(B=>(B[B.LEFT=1]="LEFT",B[B.RIGHT=2]="RIGHT",B[B.ABOVE=3]="ABOVE",B[B.BELOW=4]="BELOW",B[B.BEGIN=5]="BEGIN",B[B.END=6]="END",B))(StavePositionEnum||{});class GraphicalStaffEntry extends GraphicalObject{constructor(R,F=void 0,D=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=R,this.graphicalVoiceEntries=[],this.sourceStaffEntry=F,D?(this.staffEntryParent=D,this.parentVerticalContainer=D.parentVerticalContainer,this.PositionAndShape=new BoundingBox$2(this,D.PositionAndShape)):this.PositionAndShape=new BoundingBox$2(this,R.PositionAndShape),F&&(this.relInMeasureTimestamp=F.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(R){this.lyricsEntries=R}getAbsoluteTimestamp(){const R=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&R.Add(this.relInMeasureTimestamp),R}findTieGraphicalNoteFromNote(R){for(const F of this.graphicalVoiceEntries)for(const D of F.notes){const G=D.sourceNote;if(!G.isRest()&&G.Pitch.FundamentalNote===R.Pitch.FundamentalNote&&G.Pitch.Octave===R.Pitch.Octave&&G.getAbsoluteTimestamp().Equals(R.getAbsoluteTimestamp()))return D}}findEndTieGraphicalNoteFromNoteWithStartingSlur(R,F){if(!!R){for(const D of this.graphicalVoiceEntries)if(D.parentVoiceEntry===R.ParentVoiceEntry)for(const G of D.notes){const U=G.sourceNote;if(U.NoteTie&&U.NoteSlurs.indexOf(F)!==-1)return G}}}findGraphicalNoteFromGraceNote(R){if(!!R){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry===R.ParentVoiceEntry){for(const D of F.notes)if(D.sourceNote===R)return D}}}findGraphicalNoteFromNote(R){if(!!R){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry===R.ParentVoiceEntry){for(const D of F.notes)if(D.sourceNote===R&&this.getAbsoluteTimestamp().Equals(R.getAbsoluteTimestamp()))return D}}}getGraphicalNoteDurationFromVoice(R){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry.ParentVoice===R)return F.notes[0].graphicalNoteLength;return new Fraction$1(0,1)}findVoiceEntryGraphicalNotes(R){for(const F of this.graphicalVoiceEntries)if(F.parentVoiceEntry===R)return F.notes}isVoiceEntryPartOfLinkedVoiceEntry(R){if(this.sourceStaffEntry.Link)for(let F=0,D=this.sourceStaffEntry.Link.LinkStaffEntries.length;F0&&(R=G)}return R}findStaffEntryMaxNoteLength(){let R=new Fraction$1(0,1);for(const F of this.graphicalVoiceEntries)for(const D of F.notes){const G=D.graphicalNoteLength;R.lt(G)&&G.GetExpandedNumerator()>0&&(R=G)}return R}findOrCreateGraphicalVoiceEntry(R){for(const D of this.graphicalVoiceEntries)if(D.parentVoiceEntry===R)return D;const F=MusicSheetCalculator.symbolFactory.createVoiceEntry(R,this);return this.graphicalVoiceEntries.push(F),F}findOrCreateGraphicalVoiceEntryFromGraphicalNote(R){for(const D of this.graphicalVoiceEntries)if(D===R.parentVoiceEntry)return D;const F=MusicSheetCalculator.symbolFactory.createVoiceEntry(R.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(F),F}addGraphicalNoteToListAtCorrectYPosition(R,F){const D=R.notes;if(D.length===0||F.PositionAndShape.RelativePosition.y=0;G--){if(D[G].PositionAndShape.RelativePosition.y>F.PositionAndShape.RelativePosition.y){D.splice(G+1,0,F);break}if(G===0){D.splice(0,0,F);break}}}hasOnlyRests(){for(const F of this.graphicalVoiceEntries)for(const D of F.notes)if(!D.sourceNote.isRest())return!1;return!0}getSkylineMin(){var G;const R=(G=this.parentMeasure)==null?void 0:G.ParentStaffLine.SkyBottomLineCalculator;if(!R)return;const[F,D]=this.getAbsoluteStartAndEnd();return R.getSkyLineMinInRange(F,D)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var G;const R=(G=this.parentMeasure)==null?void 0:G.ParentStaffLine.SkyBottomLineCalculator;if(!R)return;const[F,D]=this.getAbsoluteStartAndEnd();return R.getBottomLineMaxInRange(F,D)}getAbsoluteStartAndEnd(){let R=this.PositionAndShape.AbsolutePosition.x;R-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const F=R+this.PositionAndShape.Size.width;return[R,F]}}const VF$8=Vex.Flow;class VexFlowStaffEntry extends GraphicalStaffEntry{constructor(R,F,D){super(R,F,D)}calculateXPosition(){const R=this.parentMeasure.getVFStave();let F=0;for(const D of this.graphicalVoiceEntries)if(D.vfStaveNote){if(D.vfStaveNote.setStave(R),R&&R.getLines&&R.getLines()===1&&D.vfStaveNote.getStemDirection()<0&&(D.vfStaveNote.setStemDirection(VF$8.Stem.UP),D.parentVoiceEntry.StemDirection=StemDirectionType.Up),!D.vfStaveNote.preFormatted)continue;D.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(D.vfStaveNote.getAbsoluteX()+D.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=D.vfStaveNote.getBoundingBox().getX()/unitInPixels;const G=D.notes[0].sourceNote;G.isRest()&&G.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,D.PositionAndShape.BorderLeft=-.7,D.PositionAndShape.BorderRight=.7),D.PositionAndShape.BorderLeftU.staffLine),D=this.calculateModifierXOffsets(F,1),G=this.calculateModifierXOffsets(F,.5);R.forEach((U,W)=>{U.baseFingeringXOffset=G[W],U.baseStringNumberXOffset=D[W]})}calculateModifierXOffsets(R,F){const D=[];for(let G=0;G=0;q--){if(Math.abs(R[G]-R[q])<=F&&U===D[q]){U++,W=!0;break}W=!1}D.push(U)}return D}}Vex.Flow;class VexFlowGraphicalNote extends GraphicalNote{constructor(R,F,D,G=OctaveEnum.NONE,U,W=void 0){if(super(R,F,U,W),this.clef=D,this.octaveShift=G,R.Pitch){const q=R.isRest()?R.Pitch:OctaveShift.getPitchFromOctaveShift(R.Pitch,G);this.vfpitch=VexFlowConverter.pitch(q,R.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(R){const F=this.drawPitch(R);this.vfpitch=VexFlowConverter.pitch(F,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=F.Accidental}drawPitch(R){return OctaveShift.getPitchFromOctaveShift(R,this.octaveShift)}Transpose(R,F,D,G){const U=super.Transpose(R,F,D,G),W=OctaveShift.getPitchFromOctaveShift(U,this.octaveShift);return this.vfpitch=VexFlowConverter.pitch(W,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,W}setIndex(R,F){this.vfnote=[R,F],this.vfnoteIndex=F}notehead(R=void 0){let F=R;F||(F=this.vfnote[0]);const D=F.note_heads;return D&&D.length>this.vfnoteIndex&&D[this.vfnoteIndex]?F.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(!!this.vfnote)return this.vfnote[0].getAttribute("id")}getSVGGElement(){if(!!this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){return document.getElementById("vf-"+this.getSVGId()+"-stem")}getBeamSVGs(){const R=[];for(let F=0;;F++){const D=document.getElementById(`vf-${this.getSVGId()}-beam${F}`);if(!D)break;R.push(D)}return R}}class GraphicalChordSymbolContainer extends GraphicalObject{constructor(R,F,D,G,U,W){super(),this.chordSymbolContainer=R,this.boundingBox=new BoundingBox$2(this,F),this.rules=W,this.calculateLabel(D,U,G)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(R,F,D){const G=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,F,D);this.graphicalLabel=new GraphicalLabel(new Label(G),R,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}const VF$7=Vex.Flow;class VexFlowTabMeasure extends VexFlowMeasure{constructor(R,F=void 0,D=void 0){super(R,F,D),this.isTabMeasure=!0}resetLayout(){var F;const R=(F=this.ParentStaff.StafflineCount)!=null?F:6;this.stave=new VF$7.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:R}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let F=0,D=this.staffEntries.length;F1){const q=VexFlowConverter.StrokeTypeFromArpeggioType(W.type),Y=new VF$7.Stroke(q,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&U.vfStaveNote.addStroke(0,Y)}else log$2.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}this.vfVoices[F.VoiceId].addTickable(U.vfStaveNote)}}}}class StaffLine extends GraphicalObject{constructor(R,F){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=R,this.parentStaff=F,this.boundingBox=new BoundingBox$2(this,R.PositionAndShape),this.skyBottomLine=MusicSheetCalculator.symbolFactory.createSkyBottomLineCalculator(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)switch(this.ParentStaff.StafflineCount){case 5:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*6;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount;break}else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2;break}}get Measures(){return this.measures}set Measures(R){this.measures=R}get StaffLines(){return this.staffLines}set StaffLines(R){this.staffLines=R}get Index(){return this.parentMusicSystem.StaffLines.indexOf(this)}get NextStaffLine(){const R=this.Index;return R!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[R+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(R){this.abstractExpressions=R}set LyricLines(R){this.lyricLines=R}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(R){this.lyricsDashes=R}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(R){this.parentMusicSystem=R}get ParentStaff(){return this.parentStaff}set ParentStaff(R){this.parentStaff=R}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(R){this.octaveShifts=R}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}addSlurToStaffline(R){this.graphicalSlurs.push(R)}addActivitySymbolClickArea(){const R=new StaffLineActivitySymbol(this),F=this.PositionAndShape;R.PositionAndShape.RelativePosition=new PointF2D(F.RelativePosition.x+F.BorderRight+.5,F.RelativePosition.y+.5),R.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(R){let F;for(let D=0,G=this.Measures.length;D0){const W=U.map(Y=>Y.PositionAndShape.Center.y),q=Math.max(...W);for(let Y=0;Y0?U[Y-1]:void 0;if(j){const J=this.getOverlap(K.PositionAndShape,j.PositionAndShape);K.squeeze(-(J.x+this.rules.DynamicExpressionSpacer))}if(Q){const J=this.getOverlap(Q.PositionAndShape,K.PositionAndShape);K.squeeze(J.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(R,F){const D=R.RelativePosition.x+R.BorderMarginRight,G=F.RelativePosition.x+F.BorderMarginLeft,U=R.RelativePosition.y+R.BorderMarginBottom,W=F.RelativePosition.y+F.BorderMarginTop;return new PointF2D(G-D,W-U)}getOverlap(R,F){return new PointF2D(R.RelativePosition.x+R.BorderMarginRight-(F.RelativePosition.x+F.BorderMarginLeft),R.RelativePosition.y+R.BorderMarginBottom-(F.RelativePosition.y+F.BorderMarginTop))}}class VexFlowStaffLine extends StaffLine{constructor(R,F){super(R,F),this.slursInVFStaffLine=[],this.alignmentManager=new AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(R){this.slursInVFStaffLine.push(R)}get AlignmentManager(){return this.alignmentManager}}const VF$6=Vex.Flow;class VexFlowMultiRestMeasure extends VexFlowMeasure{constructor(R,F=void 0,D=void 0){super(R,F,D),this.minimumStaffEntriesWidth=-1,D?this.rules=D.ParentMusicSystem.rules:F&&(this.rules=F.Rules),this.resetLayout(),this.multiRestElement=new VF$6.MultiMeasureRest(F.multipleRestMeasures,{})}draw(R){var U,W,q,Y,K;const F=R.openGroup();(U=F==null?void 0:F.classList)==null||U.add("vf-measure");const D=R.openGroup();(W=D==null?void 0:D.classList)==null||W.add("vf-stave"),D==null||D.setAttribute("id",(Y=(q=this.stave)==null?void 0:q.attrs)==null?void 0:Y.id),this.stave.setContext(R).draw(),R.closeGroup();const G=R.openGroup();(K=G==null?void 0:G.classList)==null||K.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(R),this.multiRestElement.draw(),R.closeGroup();for(const Z of this.connectors)Z.setContext(R).draw();return R.closeGroup(),F}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(R){return[]}getRestFilledVexFlowStaveNotesPerVoice(R){return[]}handleBeam(R,F){}handleTuplet(R,F){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(R){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(R){}getVFStave(){return this.stave}}const VF$5=Vex.Flow;class VexFlowBackend{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let R=this.canvas;return this.getVexflowBackendType()===VF$5.Renderer.Backends.CANVAS&&(R=this.inner),R}getRenderer(){return this.renderer}removeAllChildrenFromContainer(R){for(;R.children.length!==0;)R.removeChild(R.children.item(0))}removeFromContainer(R){const F=this.getRenderElement();for(let D=0;D \r<`)),U.download="opensheetmusicdisplay_download.svg",U.innerHTML=window.location.href+"/download",document.body.appendChild(U)}}class VexFlowInstantaneousDynamicExpression extends GraphicalInstantaneousDynamicExpression{constructor(R,F,D){super(R,F,D);const G=new Label(this.Expression);this.label=new GraphicalLabel(G,this.rules.ContinuousDynamicTextHeight,TextAlignmentEnum.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=FontStyles.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}class GraphicalOctaveShift extends GraphicalObject{constructor(R,F){super(),this.getOctaveShift=R,this.setSymbol(),this.PositionAndShape=new BoundingBox$2(this,F)}setSymbol(){switch(this.getOctaveShift.Type){case OctaveEnum.VA8:this.octaveSymbol=MusicSymbol.VA8;break;case OctaveEnum.VB8:this.octaveSymbol=MusicSymbol.VB8;break;case OctaveEnum.MA15:this.octaveSymbol=MusicSymbol.MA15;break;case OctaveEnum.MB15:this.octaveSymbol=MusicSymbol.MB15;break;default:throw new ArgumentOutOfRangeException("")}}}const VF$2=Vex.Flow;class VexFlowOctaveShift extends GraphicalOctaveShift{constructor(R,F){switch(super(R,F),R.Type){case OctaveEnum.VA8:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case OctaveEnum.MA15:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case OctaveEnum.VB8:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case OctaveEnum.MB15:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:log$2.error("Unknown or NONE octaveshift. This should not be called!");break}}setStartNote(R){for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote)return this.startNote=D.vfStaveNote,!0}return!1}setEndNote(R){for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote)return this.endNote=D.vfStaveNote,!0}return!1}getTextBracket(){return new VF$2.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}Vex.Flow;class VexflowStafflineNoteCalculator{constructor(R){this.staffPitchListMapping=new Dictionary,this.baseLineNote=NoteEnum.B,this.baseLineOctave=1,this.rules=R}trackNote(R){if(!(R instanceof VexFlowGraphicalNote)||R.Clef().ClefType!==ClefEnum.percussion||R.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const F=R.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let D;this.staffPitchListMapping.containsKey(F)||this.staffPitchListMapping.setValue(F,new Array),D=this.staffPitchListMapping.getValue(F);const G=R.sourceNote.Pitch;VexflowStafflineNoteCalculator.findOrInsert(D,G)}static PitchIndexOf(R,F,D=0){if(D>R.length-1)return-1;for(let G=D;Gthis.rules.PercussionOneLineCutoff&&!G)return R;const U=R,W=R.sourceNote.Pitch;let q=this.baseLineNote,Y=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&R.sourceNote.displayStepUnpitched!==void 0&&(q=R.sourceNote.displayStepUnpitched,Y=R.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),D.length<=this.rules.PercussionForceVoicesOneLineCutoff)U.setAccidental(new Pitch(q,Y,W.Accidental));else{const K=VexflowStafflineNoteCalculator.PitchIndexOf(D,W);if(K>-1){const Z=Math.ceil(D.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(K>=Z)switch(Y=2,(K-Z)%5){case 1:q=NoteEnum.E;break;case 2:q=NoteEnum.G;break;case 3:q=NoteEnum.B;break;case 4:q=NoteEnum.D,Y=3;break;default:q=NoteEnum.C;break}else switch(K%5){case 1:q=NoteEnum.F;break;case 2:q=NoteEnum.D;break;case 3:q=NoteEnum.B,Y=0;break;case 4:q=NoteEnum.G,Y=0;break;default:q=NoteEnum.A;break}const j=new Pitch(q,Y,W.Accidental);U.setAccidental(j);const Q=U.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&Q.Notes.length<2&&(j.Octave>this.baseLineOctave||j.FundamentalNote===this.baseLineNote&&j.Octave===this.baseLineOctave?U.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Up:U.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Down)}}return U}getStafflineUniquePositionCount(R){return this.staffPitchListMapping.containsKey(R)?this.staffPitchListMapping.getValue(R).length:0}}class SkyBottomLineCalculator{constructor(R){this.mStaffLineParent=R,this.mRules=R.ParentMusicSystem.rules}calculateLines(){const R=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];const F=new CanvasVexFlowBackend(this.StaffLineParent.ParentMusicSystem.rules);for(const W of this.StaffLineParent.Measures){W.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const q=W.getVFStave();let Y=q.getWidth();if(!(Y>0)&&!W.IsExtraGraphicalMeasure&&(log$2.warn("SkyBottomLineCalculator: width not > 0 in measure "+W.MeasureNumber),Y=50),!(Y>=50)&&W.IsExtraGraphicalMeasure)continue;F.initializeHeadless(Y);const K=F.getContext(),Z=F.getCanvas();Y=Z.width;const j=Z.height;this.mRules.DYMusicScoreType==="jianpu"?q.setY(q.y-50):q.setY(q.y+100);const Q=q.getWidth();q.setWidth(Y),W.format(),q.setWidth(Q);try{W.draw(K)}catch(oe){log$2.warn("SkyBottomLineCalculator.calculateLines.draw",oe)}const J=K.getImageData(0,0,Y,j),te=4,ne=Math.max(Math.ceil(W.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),ie=new Array(ne),re=new Array(ne);for(let oe=0;oe0){ie[oe]=le;break}}for(let le=j;le>0;le--){const he=le*Y*te+oe*te;if(J.data[he+3]>0){re[oe]=le;break}}}for(let oe=0;oe(W-Math.max(...this.mSkyLine))/unitInPixels+this.StaffLineParent.TopLineOffset),this.mBottomLine=this.mBottomLine.map(W=>(W-Math.min(...this.mBottomLine))/unitInPixels+this.StaffLineParent.BottomLineOffset)}findPreviousValidNumber(R,F){for(let D=R;D>=0;D--)if(!isNaN(F[D]))return F[D];return 0}findNextValidNumber(R,F){if(R>=F.length)return F[R-1];for(let D=R;D=this.BottomLine.length&&(D=this.BottomLine.length-1),G<0&&(G=0),G>=this.BottomLine.length&&(G=this.BottomLine.length),this.SkyLine[D]=R.y;for(let W=D+1;W=this.BottomLine.length&&(D=this.BottomLine.length-1),G<0&&(G=0),G>=this.BottomLine.length&&(G=this.BottomLine.length),this.BottomLine[D]=R.y;for(let W=D+1;WR)}setBottomLineWithValue(R){this.BottomLine.forEach(F=>R)}getLeftIndexForPointX(R,F){const D=Math.floor(R*this.SamplingUnit);return D<0?0:D>=F?F-1:D}getRightIndexForPointX(R,F){const D=Math.ceil(R*this.SamplingUnit);return D<0?0:D>=F?F-1:D}updateStaffLineBorders(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()}getSkyLineMin(){return Math.min(...this.SkyLine.filter(R=>!isNaN(R)))}getSkyLineMinAtPoint(R){const F=Math.round(R*this.SamplingUnit);return this.mSkyLine[F]}getSkyLineMinInRange(R,F){return this.getMinInRange(this.SkyLine,R,F)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(R=>!isNaN(R)))}getBottomLineMaxAtPoint(R){const F=Math.round(R*this.SamplingUnit);return this.mBottomLine[F]}getBottomLineMaxInRange(R,F){return this.getMaxInRange(this.BottomLine,R,F)}getBottomLineMaxInBoundingBox(R){const F=Math.floor(R.AbsolutePosition.x+R.BorderLeft),D=Math.ceil(R.AbsolutePosition.x+R.BorderRight);return this.getMaxInRange(this.mBottomLine,F,D)}updateWithBoundingBoxRecursively(R){if(R.ChildElements&&R.ChildElements.length>0)for(const F of R.ChildElements)this.updateWithBoundingBoxRecursively(F);else{const F=R.BorderTop+R.AbsolutePosition.y,D=R.BorderBottom+R.AbsolutePosition.y;if(F<0){const G=Math.floor(R.AbsolutePosition.x+R.BorderLeft),U=Math.ceil(R.AbsolutePosition.x+R.BorderRight);this.updateInRange(this.mSkyLine,G,U,F)}else if(D>this.StaffLineParent.StaffHeight){const G=Math.floor(R.AbsolutePosition.x+R.BorderLeft),U=Math.ceil(R.AbsolutePosition.x+R.BorderRight);this.updateInRange(this.mBottomLine,G,U,D)}}}updateInRange(R,F=0,D=R.length,G=0){if(F=Math.floor(F*this.SamplingUnit),D=Math.ceil(D*this.SamplingUnit),DR.length&&(D=R.length);for(let U=F;UMath.abs(R[U])?G:R[U]}setInRange(R,F=0,D=R.length,G=0){if(F=Math.floor(F*this.SamplingUnit),D=Math.ceil(D*this.SamplingUnit),DR.length&&(D=R.length);for(let U=F;U=R.length&&(F=R.length-1),D<0&&(D=0),D>=R.length&&(D=R.length),F>=0&&D<=R.length)return Math.min(...R.slice(F,D+1))}getMaxInRange(R,F,D){if(F=Math.floor(F*this.SamplingUnit),D=Math.ceil(D*this.SamplingUnit),!R)return Number.MIN_VALUE;if(F<0&&(F=0),F>=R.length&&(F=R.length-1),D<0&&(D=0),D>=R.length&&(D=R.length),F>=0&&D<=R.length)return Math.max(...R.slice(F,D+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}var parser$3={exports:{}};/*! * d-path-parser - v1.0.0 * by Massimo Artizzu (MaxArt2501) * * https://github.com/MaxArt2501/d-path-parser * * Licensed under the MIT License * See LICENSE for details */(function(B,R){(function(F,D){B.exports=D()})(commonjsGlobal$1,function(){return function(D){for(var G={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},U={number:function(ne){return+J("number",ne)},"coordinate pair":function(ne){var ie=J("number",ne);if(ie===null&&!ne)return null;J("comma");var re=J("number",!0);return{x:+ie,y:+re}},"arc definition":function(ne){var ie=U["coordinate pair"](ne);if(!ie&&!ne)return null;J("comma");var re=+J("number",!0);J("comma",!0);var oe=!!+J("flag",!0);J("comma");var le=!!+J("flag",!0);J("comma");var fe=U["coordinate pair"](!0);return{radii:ie,rotation:re,large:oe,clockwise:le,end:fe}}},W=0,q=[];WF.bottom)switch(R.tagName.toLowerCase()){case"g":for(const Q of R.children)this.recursiveUpdate(Q,F,D,G);break;case"circle":case"rect":case"line":case"path":let Z=Math.floor((U.x-D.x)/unitInPixels*this.mRules.SamplingUnit);const j=Z+Math.ceil(U.width/unitInPixels*this.mRules.SamplingUnit);if(R.parentElement.classList.contains("vf-beams")&&R.hasAttribute("d")){const Q=parse$3(R.getAttribute("d"));if(Q.length===5){const J=Q[0],te=Q[3],ne=(te.end.y-J.end.y)/(te.end.x-J.end.x);let ie=J.end.y/unitInPixels;for(Z;Z<=j;Z++)ieK[Z]&&(K[Z]=ie),ie+=ne/this.mRules.SamplingUnit}}else for(Z;Z<=j;Z++)WK[Z]&&(K[Z]=q);break}}calculateLinesForMeasure(R,F){var ge,ce,me;const D=F.getBBox(),G=Math.max(Math.round(R.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),U=D.height/unitInPixels,q=F.getElementsByClassName("vf-stave")[0].getBBox();let Y=(q==null?void 0:q.height)/unitInPixels,K=(q==null?void 0:q.y)/unitInPixels;const Z=R.getVFStave();let j=((ge=Z.options)!=null&&ge.num_lines?Z.options.num_lines:5)-1,Q=-1,J=0;const te=[j];for(const ye of(ce=Z.options)==null?void 0:ce.line_config)ye.visible?(Q===-1&&(Q=J),te.push(J)):j--,J++;const ne=te.pop();Q===-1&&(Q=0),j=ne-Q;const ie=(me=Z.options)==null?void 0:me.spacing_between_lines_px,re=j*ie/unitInPixels;Y-re>.2&&(Y=re,K=Q*ie/unitInPixels);const oe=K+Y,le=new Array(G).fill(K),fe=new Array(G).fill(oe),he=[le,fe];if(U>Y)for(const ye of F.children)this.recursiveUpdate(ye,{top:K,bottom:oe},D,[le,fe]);return he}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const R=document.createElement("div");document.body.append(R);const F=new SvgVexFlowBackend(this.mRules);F.initialize(R,1,"0");const D=F.getContext(),G=D.openGroup();G.classList.add("staffline");for(const U of this.StaffLineParent.Measures){U.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),U.setAbsoluteCoordinates(U.PositionAndShape.AbsolutePosition.x*unitInPixels,U.PositionAndShape.AbsolutePosition.y*unitInPixels);const W=U.draw(D),[q,Y]=this.calculateLinesForMeasure(U,W);this.mSkyLine.push(...q),this.mBottomLine.push(...Y)}D.closeGroup();for(const U of G.getElementsByClassName("vf-ties"))for(const W of U.childNodes)if(W.nodeName.toLowerCase()==="path"){const q=W.getBBox();let Y=Math.floor(q.x/unitInPixels*this.mRules.SamplingUnit);const K=Y+Math.ceil(q.width/unitInPixels*this.mRules.SamplingUnit),Z=q.y/unitInPixels,j=q.height/unitInPixels+Z;for(Y;Y<=K;Y++)Zthis.mBottomLine[Y]&&(this.mBottomLine[Y]=j)}F.clear(),R.remove()}}const VF$1=Vex.Flow;class VexFlowGraphicalSymbolFactory{constructor(){this.hasBBox=!1,document.createElementNS("http://www.w3.org/2000/svg","g").getBBox!==void 0&&(this.hasBBox=!0)}createMusicSystem(R,F){return new VexFlowMusicSystem(R,F)}createStaffLine(R,F){return new VexFlowStaffLine(R,F)}createSkyBottomLineCalculator(R){return R.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(R):new SkyBottomLineCalculator(R)}createGraphicalMeasure(R,F,D=!1){return new VexFlowMeasure(F,R,void 0)}createMultiRestMeasure(R,F,D){return new VexFlowMultiRestMeasure(F,R,D)}createTabStaffMeasure(R,F){return new VexFlowTabMeasure(F,R)}createExtraGraphicalMeasure(R){const F=new VexFlowMeasure(R.ParentStaff,void 0,R);return F.IsExtraGraphicalMeasure=!0,F.ExtraGraphicalMeasurePreviousMeasure=R.Measures.last(),F}createStaffEntry(R,F){return new VexFlowStaffEntry(F,R,void 0)}createVoiceEntry(R,F){return new VexFlowVoiceEntry(R,F)}createNote(R,F,D,G=OctaveEnum.NONE,U,W=void 0){return new VexFlowGraphicalNote(R,F,D,G,U,W)}createGraceNote(R,F,D,G,U=OctaveEnum.NONE){return new VexFlowGraphicalNote(R,F,D,U,G)}addGraphicalAccidental(R,F){R.setAccidental(F)}addFermataAtTiedEndNote(R,F){}createInStaffClef(R,F){const D=R,G=VexFlowConverter.Clef(F,"small");D.vfClefBefore=new VF$1.ClefNote(G.type,G.size,G.annotation)}createChordSymbols(R,F,D,G){const U=F.parentMeasure.parentSourceMeasure.Rules;let W=0;const q=U.ChordSymbolXSpacing;for(const Y of R.ChordContainers){const K=new GraphicalChordSymbolContainer(Y,F.PositionAndShape,U.ChordSymbolTextHeight,D,G,F.parentMeasure.parentSourceMeasure.Rules),Z=K.GraphicalLabel;Z.PositionAndShape.RelativePosition.y-=U.ChordSymbolYOffset,Z.PositionAndShape.RelativePosition.x+=W,Z.setLabelPositionAndShapeBorders(),K.PositionAndShape.calculateBoundingBox(),F.graphicalChordContainers.push(K),W+=Z.PositionAndShape.Size.width+q}}createGraphicalTechnicalInstruction(R,F){}}Vex.Flow;class GraphicalTie{constructor(R,F=void 0,D=void 0){this.tie=R,this.startNote=F,this.endNote=D}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(R){this.startNote=R}get EndNote(){return this.endNote}set EndNote(R){this.endNote=R}}class GraphicalLyricEntry{constructor(R,F,D,G){this.lyricsEntry=R,this.graphicalStaffEntry=F;const U=F.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;R.Text.length>=4&&R.Parent.Notes[0].Length.Denominator>4&&TextAlignmentEnum.LeftBottom;const W=new Label(R.Text);this.graphicalLabel=new GraphicalLabel(W,D,U,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,F.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,G),U===TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(R){this.graphicalLyricWord=R}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(R){this.graphicalLabel=R}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(R){this.graphicalStaffEntry=R}}class GraphicalLyricWord{constructor(R){this.graphicalLyricsEntries=[],this.lyricWord=R,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(R){this.graphicalLyricsEntries=R}isFilled(){for(let R=0;R=_GraphicalCurve.bezierCurveStepSize?new PointF2D:new PointF2D(_GraphicalCurve.oneMinusTPow3[R]*this.bezierStartPt.x+_GraphicalCurve.bezierFactorOne[R]*this.bezierStartControlPt.x+_GraphicalCurve.bezierFactorTwo[R]*this.bezierEndControlPt.x+_GraphicalCurve.tPow3[R]*this.bezierEndPt.x,_GraphicalCurve.oneMinusTPow3[R]*this.bezierStartPt.y+_GraphicalCurve.bezierFactorOne[R]*this.bezierStartControlPt.y+_GraphicalCurve.bezierFactorTwo[R]*this.bezierEndControlPt.y+_GraphicalCurve.tPow3[R]*this.bezierEndPt.y)}};let GraphicalCurve=_GraphicalCurve;GraphicalCurve.bezierCurveStepSize=1e3;const _GraphicalSlur=class extends GraphicalCurve{constructor(B,R){super(),this.staffEntries=[],this.slur=B,this.rules=R}static Compare(B,R){if(B.staffEntries.length<1)return-1;if(R.staffEntries.length<1)return 1;const F=Fraction$1.minus(B.staffEntries[B.staffEntries.length-1].getAbsoluteTimestamp(),B.staffEntries[0].getAbsoluteTimestamp()),D=Fraction$1.minus(R.staffEntries[R.staffEntries.length-1].getAbsoluteTimestamp(),R.staffEntries[0].getAbsoluteTimestamp());return F.RealValue>D.RealValue?1:D.RealValue>F.RealValue?-1:0}calculateCurve(B){const R=this.staffEntries[0],F=this.staffEntries[this.staffEntries.length-1];let D=R.findGraphicalNoteFromNote(this.slur.StartNote);!D&&this.graceStart&&(D=R.findGraphicalNoteFromGraceNote(this.slur.StartNote)),D||(D=R.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let G=F.findGraphicalNoteFromNote(this.slur.EndNote);!G&&this.graceEnd&&(G=F.findGraphicalNoteFromGraceNote(this.slur.EndNote));const U=R.parentMeasure.ParentStaffLine,W=U.SkyBottomLineCalculator;this.calculatePlacement(W,U);const q=this.calculateStartAndEnd(D,G,U,B,W),Y=q.startX,K=q.endX;let Z=q.startY,j=q.endY;const Q=B.SlurTangentMinAngle,J=B.SlurTangentMaxAngle;let te;if(this.placement===PlacementEnum.Above){Z-=B.SlurNoteHeadYOffset,j-=B.SlurNoteHeadYOffset;const ne=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,Z);D?ne.x+=this.staffEntries[0].PositionAndShape.BorderRight:ne.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(ne.x+=F.PositionAndShape.RelativePosition.x);const ie=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,j);if(G?ie.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:ie.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(ie.x+=F.staffEntryParent.PositionAndShape.RelativePosition.x),te=this.calculateTopPoints(ne,ie,U,W),te.length===0){const $e=new PointF2D((ie.x-ne.x)/2+ne.x,(ie.y-ne.y)/2+ne.y);te.push($e)}const re=Math.atan((j-Z)/(K-Y)),oe=new PointF2D(0,0);let le=new PointF2D(K-Y,-(j-Z));const fe=Matrix2D.getRotationMatrix(re),he=fe.getTransposeMatrix();le=fe.vectorMultiplication(le);const ge=this.calculateTranslatedAndRotatedPointListAbove(te,Y,Z,fe);let ce=this.calculateMaxLeftSlope(ge,oe,le),me=this.calculateMaxRightSlope(ge,oe,le);const ye=oe.y-oe.x*ce,ve=le.y-le.x*me,pe=new PointF2D;let be=!1;Math.abs(Math.abs(ce)-Math.abs(me))<1e-4?(pe.x=le.x/2,pe.y=0,be=!0):(pe.x=(ve-ye)/(ce-me),pe.y=ce*pe.x+ye);const xe=this.calculateHeightWidthRatio(le.x,ge);let ue=0,_e=0;if(Math.abs(xe)>.001){const $e=Math.abs(ce/(xe*2)),We=Math.abs(ce);ue=Math.max(0,We*(Math.min(10,$e-1)/10)),ce-=ue;const Ve=Math.abs(me/(xe*2)),qe=Math.abs(me);_e=Math.max(0,qe*(Math.min(10,Ve-1)/10)),me+=_e}let Be=Q,Ae=-Q;if(!be){const $e=this.calculateAngles(Q,ce,me,J);Be=$e.startAngle,Ae=$e.endAngle}const Pe=this.calculateControlPoints(le.x,Be,Ae,ge,xe,Z,j);let Ie=Pe.startControlPoint,Ce=Pe.endControlPoint;Ie=he.vectorMultiplication(Ie),Ie.x+=Y,Ie.y=-Ie.y+Z,Ce=he.vectorMultiplication(Ce),Ce.x+=Y,Ce.y=-Ce.y+Z,this.bezierStartPt=new PointF2D(Y,Z-ue),this.bezierStartControlPt=new PointF2D(Ie.x,Ie.y-ue),this.bezierEndControlPt=new PointF2D(Ce.x,Ce.y-_e),this.bezierEndPt=new PointF2D(K,j-_e);const Te=U.SkyLine.length,Se=W.getLeftIndexForPointX(this.bezierStartPt.x,Te),Ne=W.getLeftIndexForPointX(this.bezierEndPt.x,Te),Ge=this.bezierEndPt.x-this.bezierStartPt.x,ke=W.SamplingUnit;for(let $e=Se;$e=Se&&(U.SkyLine[qe]=Math.min(U.SkyLine[qe],Ve.y)),qe++,qe.001){const $e=Math.abs(ce/(xe*2)),We=Math.abs(ce);ue=Math.max(0,We*(Math.min(10,$e-1)/10)),ce-=ue;const Ve=Math.abs(me/(xe*2)),qe=Math.abs(me);_e=Math.max(0,qe*(Math.min(10,Ve-1)/10)),me+=_e}let Be=Q,Ae=-Q;if(!be){const $e=this.calculateAngles(Q,ce,me,J);Be=$e.startAngle,Ae=$e.endAngle}const Pe=this.calculateControlPoints(le.x,Be,Ae,ge,xe,Z,j);let Ie=Pe.startControlPoint,Ce=Pe.endControlPoint;Ie=he.vectorMultiplication(Ie),Ie.x+=Y,Ie.y+=Z,Ce=he.vectorMultiplication(Ce),Ce.x+=Y,Ce.y+=Z,this.bezierStartPt=new PointF2D(Y,Z+ue),this.bezierStartControlPt=new PointF2D(Ie.x,Ie.y+ue),this.bezierEndControlPt=new PointF2D(Ce.x,Ce.y+_e),this.bezierEndPt=new PointF2D(K,j+_e);const Te=U.BottomLine.length,Se=W.getLeftIndexForPointX(this.bezierStartPt.x,Te),Ne=W.getLeftIndexForPointX(this.bezierEndPt.x,Te),Ge=this.bezierEndPt.x-this.bezierStartPt.x,ke=W.SamplingUnit;for(let $e=Se;$e=Se&&(U.BottomLine[qe]=Math.max(U.BottomLine[qe],Ve.y)),qe++,qe0){this.placement=PlacementEnum.Above;return}const F=this.staffEntries[0],D=this.staffEntries[this.staffEntries.length-1],G=F.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,U=D.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(G===U)this.placement=G===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{let W=F.PositionAndShape.BorderLeft+F.PositionAndShape.RelativePosition.x+F.parentMeasure.PositionAndShape.RelativePosition.x,q=D.PositionAndShape.BorderRight+D.PositionAndShape.RelativePosition.x+D.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(W+=D.PositionAndShape.RelativePosition.x),this.graceEnd&&(q+=D.staffEntryParent.PositionAndShape.RelativePosition.x);const Y=B.getSkyLineMinInRange(W,q)*-1;B.getBottomLineMaxInRange(W,q)-R.StaffHeight>Y?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below}}calculateTopPoints(B,R,F,D){const G=[];let U=D.getRightIndexForPointX(B.x,F.SkyLine.length),W=D.getLeftIndexForPointX(R.x,F.SkyLine.length);U<0&&(U=0),W>=F.SkyLine.length&&(W=F.SkyLine.length-1);for(let q=U;q=F.BottomLine.length&&(W=F.BottomLine.length-1);for(let q=U;qK&&B>Z&&(Y+=B/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,Y*=1+R/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,q/=Y);const j=Math.min(.5,Math.max(.1,1.7*R/80*q*Math.pow(Math.max(G,.05),.4))),Q=Math.min(.5,Math.max(.1,1.7*-F/80*q*Math.pow(Math.max(G,.05),.4))),J=new PointF2D;J.x=B*j*Math.cos(R*_GraphicalSlur.degreesToRadiansFactor),J.y=B*j*Math.sin(R*_GraphicalSlur.degreesToRadiansFactor);const te=new PointF2D;te.x=B-B*Q*Math.cos(F*_GraphicalSlur.degreesToRadiansFactor),te.y=-(B*Q*Math.sin(F*_GraphicalSlur.degreesToRadiansFactor));let ne=J.y-te.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(ne)>this.rules.SlurMaximumYControlPointDistance;)ne<0?(J.y+=1,te.y-=1):(J.y-=1,te.y+=1),ne=J.y-te.y;return{startControlPoint:J,endControlPoint:te}}calculateAngles(B,R,F,D){let U=Math.atan(R)/_GraphicalSlur.degreesToRadiansFactor;R>0?U+=20:U-=20;let W=Math.atan(F)/_GraphicalSlur.degreesToRadiansFactor;F<0?W-=20:W+=20;const q=Math.min(Math.max(B,U),D),Y=Math.max(Math.min(-B,W),-D);return{startAngle:q,endAngle:Y}}};let GraphicalSlur=_GraphicalSlur;GraphicalSlur.degreesToRadiansFactor=Math.PI/180;class GraphicalPedal extends GraphicalObject{constructor(R,F){super(),this.getPedal=R,this.setSymbol(),this.PositionAndShape=new BoundingBox$2(this,F)}setSymbol(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_MIXED:this.pedalSymbol=MusicSymbol.PEDAL_BRACKET}}class VexFlowPedal extends GraphicalPedal{constructor(R,F,D=!1,G=!1){switch(super(R,F),this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=R.ChangeBegin,this.ChangeEnd=R.ChangeEnd,this.pedalSymbol){case MusicSymbol.PEDAL_SYMBOL:this.vfStyle=Vex.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new BoundingBox$2(this,F);break;case MusicSymbol.PEDAL_MIXED:D&&G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:D?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:G?this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:D&&G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:D?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:G?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(R){if(!R)return!1;for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote)return this.startNote=D.vfStaveNote,this.startVfVoiceEntry=D,!0}return!1}setEndNote(R){if(!R)return!1;for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote)return this.endNote=D.vfStaveNote,this.endVfVoiceEntry=D,!0}return!1}setEndMeasure(R){this.endMeasure=R}CalculateBoundingBox(){}setLine(R){this.line=R}getPedalMarking(){var F,D,G,U;const R=new Vex.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&R.setEndStave(this.endMeasure.getVFStave()),R.setStyle(this.vfStyle),R.setLine(this.line),R.setCustomText(this.DepressText,this.ReleaseText),(((F=this.endVfVoiceEntry)==null?void 0:F.parentStaffEntry)===((U=(G=(D=this.endVfVoiceEntry)==null?void 0:D.parentStaffEntry)==null?void 0:G.parentMeasure)==null?void 0:U.staffEntries.last())||!this.endVfVoiceEntry)&&(R.EndsStave=!0),R.ChangeBegin=this.ChangeBegin,R.ChangeEnd=this.ChangeEnd,R}}class GraphicalWavyLine extends GraphicalObject{constructor(R,F){super(),this.getWavyLine=R,this.PositionAndShape=new BoundingBox$2(this,F)}}class VexflowVibratoBracket extends GraphicalWavyLine{constructor(R,F,D=!1){super(R,F),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=D}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(R){for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote)return this.startNote=D.vfStaveNote,this.startVfVoiceEntry=D,!0}return!1}setEndNote(R){for(const F of R.graphicalVoiceEntries){const D=F;if(D!=null&&D.vfStaveNote){this.endNote=D.vfStaveNote,this.endVfVoiceEntry=D;const G=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,U=G[G.length-1];return this.toEndOfStopStave=U===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const R=this.getVibratoBracket();this.boundingBox.Size.height=R.render_options.wave_height*.2}getVibratoBracket(){const R=new Vex.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return R.setLine(this.line),this.isVibrato?R.render_options.vibrato_width=20:R.render_options.wave_girth=4,R}}const VF=Vex.Flow;class VexFlowMusicSheetCalculator extends MusicSheetCalculator{constructor(R){var F,D,G,U,W,q,Y,K;super(),this.beamsNeedUpdate=!1,this.rules=R,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(this.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules),((F=this.rules.DefaultVexFlowNoteFont)==null?void 0:F.toLowerCase())==="gonville"?Vex.Flow.DEFAULT_FONT_STACK=[(D=Vex.Flow.Fonts)==null?void 0:D.Gonville,(G=Vex.Flow.Fonts)==null?void 0:G.Bravura,(U=Vex.Flow.Fonts)==null?void 0:U.Custom]:((W=this.rules.DefaultVexFlowNoteFont)==null?void 0:W.toLowerCase())==="petaluma"&&(Vex.Flow.DEFAULT_FONT_STACK=[(q=Vex.Flow.Fonts)==null?void 0:q.Petaluma,(Y=Vex.Flow.Fonts)==null?void 0:Y.Gonville,(K=Vex.Flow.Fonts)==null?void 0:K.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);for(const R of this.graphicalMusicSheet.MeasureList)for(const F of R)F==null||F.clean()}formatMeasures(){for(const R of this.graphicalMusicSheet.MeasureList){if(!R||!R[0])continue;R[0].format();for(const D of R){for(const G of D.staffEntries)G.calculateXPosition();D.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(R){const F=[];for(const Z of R)Z&&F.push(Z);if(F.length===0)return 0;R=F;const D=[],G=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let U=R[0].staffEntries.length,W=1;for(const Z of R){if(!Z)continue;let j=0;for(const te of Z.staffEntries)j+=te.setMaxAccidentals();Z.parentSourceMeasure.ImplicitMeasure&&(U=Math.max(Z.staffEntries.length,U),W=Math.max(Z.staffEntries.length+j,W));const Q=Z.vfVoices,J=[];for(const te in Q)Q.hasOwnProperty(te)&&(J.push(Q[te]),D.push(Q[te]));if(J.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",Q);continue}G.joinVoices(J)}let q=12;const Y=R[0].parentSourceMeasure,K=.3;if(D.length>0){q=G.preCalculateMinTotalWidth(D)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+U*K,Y!=null&&Y.ImplicitMeasure&&(q=Y.Duration.RealValue/Y.ActiveTimeSignature.RealValue*q,U>1&&(q+=W*K*1.5),q*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(R,q);const Z=(Q,J)=>{G.formatToStave(D,J.getVFStave())},j=(Q,J)=>{G.formatToStave(D,J.getVFStave(),{align_rests:!0,context:void 0})};for(const Q of R){if(this.rules.AlignRests===AlignRestOption.Never)Q.formatVoices=Z;else if(this.rules.AlignRests===AlignRestOption.Always)Q.formatVoices=j;else if(this.rules.AlignRests===AlignRestOption.Auto){let J=!1;for(const te of Q.staffEntries){let ne=0,ie=0;for(const re of te.graphicalVoiceEntries)if(re.parentVoiceEntry.IsGrace||re&&re.notes&&re.notes[0]&&re.notes[0].sourceNote&&re.notes[0].sourceNote.PrintObject&&ne++,re&&re.notes&&re.notes[0]&&re.notes[0].sourceNote&&re.notes[0].sourceNote.isRest()&&re.notes[0].sourceNote.PrintObject&&ie++,ne>1&&ie>=1){J=!0;break}if(J)break}J?Q.formatVoices=j:Q.formatVoices=Z}if(Q===R[0]){const J=Q;J.formatVoices(q*unitInPixels,J)}}}for(const Z of R)if(!!Z)for(const j of Z.staffEntries)j.calculateXPosition();for(const Z of R){if(!Z)continue;const j=Z.vfVoices,Q=[];for(const J in j)j.hasOwnProperty(J)&&Q.push(j[J]);if(Q.length===0){log$2.debug("Found a measure with no voices. Continuing anyway.",j);continue}G.joinVoices(Q)}return q}calculateElongationFactor(R,F,D,G,U,W,q,Y){let K=U,Z=0;for(const j of R){const Q=j.GraphicalLabel.Label.textAlignment;let J=q,te=Y;if(j instanceof GraphicalLyricEntry&&j.ParentLyricWord){j.LyricsEntry.SyllableIndex>0&&(J=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(Q)&&(J+=1));const be=j.ParentLyricWord.GetLyricWord.Syllables;be.length>1&&j.LyricsEntry.SyllableIndex4&&(ve*=1.1)}}else D[Z]&&(ve=le/fe);me=Math.max(ye,ve),K=Math.max(K,me);let pe=Math.max(le-fe||0,0);D[Z]&&(pe+=D[Z].cumulativeOverlap),D[Z]={cumulativeOverlap:pe,extend:j instanceof GraphicalLyricEntry?j.LyricsEntry.extend:!1,labelWidth:ie,measureNumber:W,sourceNoteDuration:j instanceof GraphicalLyricEntry?j.LyricsEntry&&j.LyricsEntry.Parent.Notes[0].Length:!1,text:j instanceof GraphicalLyricEntry?j.LyricsEntry.Text:j.GraphicalLabel.Label.text,xPosition:oe},Z++}return K}calculateElongationFactorFromStaffEntries(R,F,D,G){let U=D;const W={},q={};for(const Y of R)Y.LyricsEntries.length>0&&(U=this.calculateElongationFactor(Y.LyricsEntries,Y,W,F,U,G,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),Y.graphicalChordContainers.length>0&&(U=this.calculateElongationFactor(Y.graphicalChordContainers,Y,q,F,U,G,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return U}calculateMeasureWidthFromStaffEntries(R,F){let D=1;for(const U of R)!U||U.staffEntries.length===0||(D=this.calculateElongationFactorFromStaffEntries(U.staffEntries,F,D,U.MeasureNumber));return D=Math.min(D,this.rules.MaximumLyricsElongationFactor),F*D}createGraphicalTie(R,F,D,G,U){return new GraphicalTie(R,G,U)}updateStaffLineBorders(R){R.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(R){R.rules=this.rules,R.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(R,F,D,G){for(let U=0;U=2&&(W=G.vfnote[0],q=G.vfnote[1]);let Y,K=0;if(U&&U.vfnote&&U.vfnote.length>=2&&(Y=U.vfnote[0],K=U.vfnote[1]),F){if(W){const Z=new VF.StaveTie({first_indices:[q],first_note:W});G.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,R)}if(Y){const Z=new VF.StaveTie({last_indices:[K],last_note:Y});U.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,R)}}else if(W||Y){let Z;if(D)if(R.Tie.Type==="S"){const Q=R.StartNote.sourceNote,J=R.EndNote.sourceNote;let te=1;Q.FretNumber>J.FretNumber&&(te=-1),Z=new VF.TabSlide({first_indices:[q],first_note:W,last_indices:[K],last_note:Y},te)}else Z=new VF.TabTie({first_indices:[q],first_note:W,last_indices:[K],last_note:Y},R.Tie.Type);else{Z=new VF.StaveTie({first_indices:[q],first_note:W,last_indices:[K],last_note:Y});const Q=R.Tie.getTieDirection(G.sourceNote);Q===PlacementEnum.Below?Z.setDirection(1):Q===PlacementEnum.Above&&Z.setDirection(-1);try{Math.abs((W==null?void 0:W.getTieRightX())-(Y==null?void 0:Y.getTieLeftX()))<10&&(Z.render_options.first_x_shift=-3,Z.render_options.last_x_shift=3)}catch(J){console.log(J)}}U.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(Z,R)}}calculateDynamicExpressionsForMultiExpression(R,F,D){if(Fthis.rules.MaxMeasureToDrawIndex)return;const G=R.AbsoluteTimestamp,U=this.graphicalMusicSheet.MeasureList[F],W=U[D].ParentStaffLine,q=U[D];if(!W)return;const Y=this.getRelativePositionInStaffLineFromTimestamp(G,D,W,W==null?void 0:W.isPartOfMultiStaffInstrument());if(Y.x<=0&&(Y.x=q.beginInstructionsWidth+this.rules.RhythmRightMargin),R.InstantaneousDynamic){const K=new VexFlowInstantaneousDynamicExpression(R.InstantaneousDynamic,W,q);this.calculateGraphicalInstantaneousDynamicExpression(K,Y,G),this.dynamicExpressionMap.set(G.RealValue,K.PositionAndShape)}if(R.StartingContinuousDynamic){const K=R.StartingContinuousDynamic,Z=new VexFlowContinuousDynamicExpression(R.StartingContinuousDynamic,W,q.parentSourceMeasure);if(Z.StartMeasure=q,!Z.IsVerbal&&K.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(Z,Y),Z.updateSkyBottomLine()}catch{}else Z.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(Z,Y):log$2.warn("This continuous dynamic is not covered. measure"+R.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(R,F){var oe,le,fe,he,ge,ce,me,ye,ve;const D=Math.max(R.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),G=F||D,U=Math.max(R.StaffNumber-1,0),W=this.graphicalMusicSheet.MeasureList[G][U].getVFStave();let q="q";if(R.beatUnit){const pe=NoteTypeHandler.getNoteDurationFromType(R.beatUnit);q=VexFlowConverter.durations(pe,!1)[0]}let Y=this.rules.MetronomeMarkYShift,K=!1;const Z=[];if(R.parentMeasure){for(const pe of R.parentMeasure.StaffLinkedExpressions)for(const be of pe)be&&be instanceof UnknownExpression&&Z.push(be);for(const pe of R.parentMeasure.TempoExpressions){const be=((oe=pe.InstantaneousTempo)==null?void 0:oe.Enum)===TempoEnum.metronomeMark;if(!R.beatUnit&&pe.InstantaneousTempo.beatUnit){const xe=NoteTypeHandler.getNoteDurationFromType(R.beatUnit);q=VexFlowConverter.durations(xe,!1)[0]}if(pe.getPlacementOfFirstEntry()===PlacementEnum.Above&&!be){K=!0;break}}}K&&(Y-=1.4);const j=(le=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:le.SkyLine;let Q=R.TempoInBpm,J="",te="",ne="";for(const pe of this.graphicalMusicSheet.MeasureList[G][U].parentSourceMeasure.TempoExpressions){if(te=pe.CombinedExpressionsText,isSpecialMark(pe.CombinedExpressionsText)){J=pe.CombinedExpressionsText;break}if(isSpeedKeyword(pe.CombinedExpressionsText)||isSpeedHiddenKeyword(pe.CombinedExpressionsText)){J=formatSpeedKeyword(pe.CombinedExpressionsText),Q=pe.sourceMeasure.TempoInBPM,isSpeedKeyword(pe.CombinedExpressionsText)&&(ne=q);break}}const ie={bpm:R.TempoInBpm,dots:R.dotted,duration:q,name:J};J&&(ie.bpm=Q/(ie.dots?1.5:1),isSpeedKeyword(te)?ie.duration=ne:(Q===SpeedTag[J]||!SpeedTag[J])&&(ie.duration=""));const re=((he=(fe=this.graphicalMusicSheet.MeasureList[G][U].vfVoices)==null?void 0:fe[1])==null?void 0:he.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(j){const ue=((ce=(ge=this.graphicalMusicSheet.MeasureList[0])==null?void 0:ge[U])==null?void 0:ce.ParentStaffLine).Measures.map(_e=>_e.MeasureNumber-1);if(re&&ue.includes(G)&&(isSpeedKeyword(te)||isSpeedHiddenKeyword(te))){const _e=j.slice(0,9);let Be=Math.min(..._e);Be=Be<0?Be-1:Be,Y+=Be}ue.includes(G)&&Z.length?j[0]=Math.min(j[0],-4.5+Y-4):j[0]=Math.min(j[0],-4.5+Y)}W.options.line_config.reduce((xe,ue)=>(ue.visible&&xe++,xe),0)<5&&(Y-=2),W.setTempo(ie,Y*unitInPixels);let be=0;try{be+=((ve=(ye=(me=this.graphicalMusicSheet.MeasureList[G][U])==null?void 0:me.vfVoices)==null?void 0:ye[1])==null?void 0:ve.getTickables())[R.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-W.getNoteStartX()}catch{}W.getModifiers()[W.getModifiers().length-1].setShiftX(be)}}calculateRehearsalMark(R){var Q,J,te,ne,ie;const F=R.rehearsalExpression;if(!F)return;const D=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,G=Math.max(R.measureListIndex+1-D,0),U=0,W=(Q=this.graphicalMusicSheet.MeasureList[G][U])==null?void 0:Q.getVFStave();if(!W)return;const q=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let Y=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;R.IsSystemStartMeasure&&(Y+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const K=this.rules.RehearsalMarkFontSize,Z=W.getModifiers(),j=Z.find(re=>re.getCategory().toLocaleLowerCase()==="repetitions");if(j&&j.setShiftY(j.y_shift-10),W.setSection(F.label,q,Y,K),(J=this.graphicalMusicSheet.MeasureList[G][U])!=null&&J.ParentStaffLine.AbstractExpressions){const re=Z.find(oe=>oe.getCategory().toLocaleLowerCase()==="stavesection");for(let oe of((ie=(ne=(te=R==null?void 0:R.VerticalMeasureList)==null?void 0:te[0])==null?void 0:ne.ParentStaffLine)==null?void 0:ie.AbstractExpressions)||[])oe instanceof GraphicalUnknownExpression&&(re&&(oe.Label.PositionAndShape.RelativePosition.y-=.5),j&&(oe.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(R,F,D,G){var te;const U=F.OctaveShiftStart,W=U.ParentStartMultiExpression.Timestamp,q=(te=U.ParentEndMultiExpression)==null?void 0:te.Timestamp,Y=this.rules.MinMeasureToDrawIndex,K=this.rules.MaxMeasureToDrawIndex;let Z=this.graphicalMusicSheet.MeasureList[D][G].ParentStaffLine;Z||(Z=this.graphicalMusicSheet.MeasureList[Y][G].ParentStaffLine);let j;U.ParentEndMultiExpression?j=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(U.ParentEndMultiExpression.SourceMeasureParent,G):j=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0),j.MeasureNumber>K+1&&(j=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let Q;if(U.ParentEndMultiExpression?Q=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(U.ParentStartMultiExpression.SourceMeasureParent,G):Q=this.graphicalMusicSheet.MeasureList[Y][G],Q.MeasureNumberK||j.parentSourceMeasure.measureListIndexK)return;let J=j.ParentStaffLine;if(J||(J=Z),j&&Z&&J){const ne=new VexFlowOctaveShift(U,Z.PositionAndShape);if(!ne.startNote){let oe;for(const le of Q.staffEntries)if(le){oe=le;break}if(!oe||(ne.setStartNote(oe),!ne.startNote))return}if(!ne.endNote){let oe;for(let le=j.staffEntries.length-1;le>=0;le++)if(j.staffEntries[le]){oe=j.staffEntries[le];break}if(ne.setEndNote(oe),!ne.endNote)return}let ie=Q.findGraphicalStaffEntryFromTimestamp(W);ie||(ie=Q.staffEntries[0]);let re=j.findGraphicalStaffEntryFromTimestamp(q);if(re||(re=j.staffEntries[j.staffEntries.length-1]),ne.setStartNote(ie),J!==Z){ne.endsOnDifferentStaffLine=!0;let oe=Z.Measures[Z.Measures.length-1];oe===void 0&&(oe=j);const le=oe.staffEntries[oe.staffEntries.length-1];ne.setEndNote(le);const fe=J.ParentMusicSystem.Id-Z.ParentMusicSystem.Id;if(fe>0)for(let he=Z.ParentMusicSystem.Id;heK+1&&(j=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let Q;if(U.ParentEndMultiExpression?Q=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(U.ParentStartMultiExpression.SourceMeasureParent,G):(Q=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(U.ParentStartMultiExpression.SourceMeasureParent,G),Q||(Q=this.graphicalMusicSheet.MeasureList[Y][G])),Q.MeasureNumberK||j.parentSourceMeasure.measureListIndexK)return;let J=j.ParentStaffLine;if(J||(J=Z),j&&Z&&J){let ne=!1;Z!==J&&(ne=!0);const ie=new VexFlowPedal(U,Z.PositionAndShape,!1,ne);let re=Q.findGraphicalStaffEntryFromTimestamp(W);re||(re=Q.staffEntries[0]);let oe=j.findGraphicalStaffEntryFromTimestamp(q);if(oe||(oe=j.staffEntries[j.staffEntries.length-1]),!ie.setStartNote(re))return;if(J!==Z)if(ie.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){ie.setEndNote(oe),ie.setEndMeasure(j),ie.ReleaseText=" ",ie.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(ie.startVfVoiceEntry,ie.endVfVoiceEntry,ie,Z);const le=J.Measures[0],fe=new VexFlowPedal(U,le.PositionAndShape),he=le.staffEntries[0];if(!fe.setStartNote(he))return;fe.setEndNote(oe),ie.setEndMeasure(j),J.Pedals.push(fe),fe.CalculateBoundingBox(),fe.DepressText=" ",this.calculatePedalSkyBottomLine(fe.startVfVoiceEntry,fe.endVfVoiceEntry,fe,J)}else{let le=Z.Measures[Z.Measures.length-1];le===void 0&&(le=j);const fe=le.staffEntries[le.staffEntries.length-1];ie.setEndNote(fe),ie.setEndMeasure(j),ie.ChangeEnd=!1;const he=J.ParentMusicSystem.Id-Z.ParentMusicSystem.Id;if(he>0){let ge=1;for(let ce=Z.ParentMusicSystem.Id;ceK+1&&(j=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(G,!0));let Q;if(U.ParentEndMultiExpression?Q=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(U.ParentStartMultiExpression.SourceMeasureParent,G):Q=this.graphicalMusicSheet.MeasureList[Y][G],Q.MeasureNumberK||j.parentSourceMeasure.measureListIndexK)return;let J=j.ParentStaffLine;if(J||(J=Z),j&&Z&&J){const ie=new VexflowVibratoBracket(U,Z.PositionAndShape,Q.ParentStaff.isTab);let re=Q.findGraphicalStaffEntryFromTimestamp(W);re||(re=Q.staffEntries[0]);let oe=j.findGraphicalStaffEntryFromTimestamp(q);if(oe||(oe=j.staffEntries[j.staffEntries.length-1]),ie.setStartNote(re),J!==Z){let le=Z.Measures[Z.Measures.length-1];le===void 0&&(le=j);const fe=le.staffEntries[le.staffEntries.length-1];if(ie.setEndNote(fe),J.ParentMusicSystem.Id-Z.ParentMusicSystem.Id>0)for(let ge=Z.ParentMusicSystem.Id;gej){const le=j;j=Z,Z=le}G.SkyBottomLineCalculator.updateBottomLineInRange(Z,j,Q+re)}for(const re of G.Pedals){const oe=re,le=oe.getPedalMarking(),fe=le.line+3+(G.StaffLines.length-1);if(Q>fe){const he=le.render_options.text_margin_right/10;let ge=oe.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-he,ce;oe.setLine(Q-3-(G.StaffLines.length-1));let me=(te=oe.endVfVoiceEntry)==null?void 0:te.PositionAndShape;if(me||(me=oe.endMeasure.PositionAndShape),oe.EndSymbolPositionAndShape){const ye=q.render_options.glyph_point_size/20;ce=ge+3.4;const ve=me.AbsolutePosition.x-he,pe=ve+1.5;G.SkyBottomLineCalculator.updateBottomLineInRange(ge,ce,Q+ye),G.SkyBottomLineCalculator.updateBottomLineInRange(ve,pe,Q+ye)}else{const ye=le.render_options.bracket_height/10;if(le.EndsStave)ce=me.AbsolutePosition.x+me.Size.width-he;else switch(q.style){case W.BRACKET_OPEN_END:case W.BRACKET_OPEN_BOTH:case W.MIXED_OPEN_END:ce=me.AbsolutePosition.x+me.BorderRight-he;break;default:ce=me.AbsolutePosition.x+me.BorderLeft-he;break}const ve=(ie=(ne=oe.endVfVoiceEntry)==null?void 0:ne.parentStaffEntry)==null?void 0:ie.vfClefBefore;if(ve&&(ce+=ve.getWidth()/10),ge>ce){const pe=ge;ge=ce,ce=pe}G.SkyBottomLineCalculator.updateBottomLineInRange(ge,ce,Q+ye)}}}}calculateOctaveShiftSkyBottomLine(R,F,D,G){if(!F){log$2.warn("octaveshift: no endStaffEntry");return}let U=R.PositionAndShape.Size.width,W=F.PositionAndShape.Size.width;R.hasOnlyRests()?U=-U:U/=2,F.hasOnlyRests()?W*=2:W/=2,R===F&&(W*=2);const q=R.PositionAndShape.AbsolutePosition.x-U,Y=F.PositionAndShape.AbsolutePosition.x+W;D.PositionAndShape.Size.width=q-Y;const K=D.getTextBracket(),Z=K.font.size/10;if(K.position===VF.TextBracket.Positions.TOP){const j=Math.ceil(G.SkyBottomLineCalculator.getSkyLineMinInRange(q,Y));if(j===1/0)return;K.start.getStave().options.top_text_position=Math.abs(j),G.SkyBottomLineCalculator.updateSkyLineInRange(q,Y,j-Z*2)}else{const j=G.SkyBottomLineCalculator.getBottomLineMaxInRange(q,Y);if(j===1/0)return;K.start.getStave().options.bottom_text_position=j,R.parentMeasure!==F.parentMeasure&&(K.stop.getStave().options.bottom_text_position=j),G.SkyBottomLineCalculator.updateBottomLineInRange(q,Y,j+Z*1.5)}}calculateWordRepetitionInstruction(R,F){let D;const G=this.graphicalMusicSheet.MeasureList[F];for(let U=0,W=G.length;U{D.updateSkyBottomLine()})}catch{}}handleTiedGraphicalNote(R,F,D,G,U,W,q,Y){}handleBeam(R,F,D){R.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(R,F)}handleVoiceEntryLyrics(R,F,D){R.LyricsEntries.forEach((G,U)=>{const W=new GraphicalLyricEntry(U,F,this.rules.LyricsHeight,this.rules.StaffHeight);if(F.LyricsEntries.push(W),W.GraphicalLabel.setLabelPositionAndShapeBorders(),U.Word){const Y=U.Word.Syllables.indexOf(U);let K=D.indexOf(U.Word);if(K===-1&&(D.push(U.Word),K=D.indexOf(U.Word)),this.graphicalLyricWords.length===0||K>this.graphicalLyricWords.length-1){const Z=new GraphicalLyricWord(U.Word);W.ParentLyricWord=Z,Z.GraphicalLyricsEntries[Y]=W,this.graphicalLyricWords.push(Z)}else{const Z=this.graphicalLyricWords[K];W.ParentLyricWord=Z,Z.GraphicalLyricsEntries[Y]=W,Z.isFilled()&&(D.splice(K,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(Z),1))}}})}handleVoiceEntryOrnaments(R,F,D){}handleVoiceEntryArticulations(R,F,D){}handleVoiceEntryTechnicalInstructions(R,F,D){}handleTuplet(R,F,D){R.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(R,F)}findIndexGraphicalSlurFromSlur(R,F){for(let D=0;D=0){const j=G[Z];j.staffEntries.indexOf(W)===-1&&j.staffEntries.push(W),G.splice(Z,1)}}}for(const q of G)q.staffEntries.indexOf(W)===-1&&q.staffEntries.push(W)}}for(const F of this.musicSystems)for(const D of F.StaffLines){const G=D.GraphicalSlurs.sort(GraphicalSlur.Compare);for(const U of G)U.slur.isCrossed()||U.calculateCurve(this.rules)}}}class MusicPartManager{constructor(R){this.musicSheet=R}reInit(){this.init()}init(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new Fraction$1(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}getCurrentRepetitionTimestampTransform(R){let F;for(let D=this.timestamps.length-1;D>=0;D--)if(F=this.timestamps[D],R.gte(F.from))return F;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(R){if(this.timestamps.length===0)return R;const F=this.getCurrentRepetitionTimestampTransform(R);return Fraction$1.plus(R,Fraction$1.minus(F.to,F.from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(R){return R?new MusicPartManagerIterator(this.musicSheet,R,void 0):new MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(R){this.musicSheet.SelectionStart=R,this.musicSheet.SelectionEnd=void 0}setSelectionRange(R,F){this.musicSheet.SelectionStart=R!=null?R:this.sheetStart,this.musicSheet.SelectionEnd=F!=null?F:this.sheetEnd}calcMapping(){this.timestamps=[];const R=this.getIterator();let F=R.CurrentRepetition,D=new TimestampTransform(R.CurrentEnrolledTimestamp.clone(),R.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(D);!R.EndReached;){if(R.JumpOccurred||F!==R.CurrentRepetition){if(F=R.CurrentRepetition,R.backJumpOccurred){const G=R.JumpResponsibleRepetition;D.nextBackJump=R.CurrentEnrolledTimestamp,D.curRepetition=G,D.curRepetitionIteration=R.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let U=this.timestamps.length-2;U>=0&&!(G.AbsoluteTimestamp.gt(this.timestamps[U].to)||this.timestamps[U].curRepetition);U--)this.timestamps[U].nextBackJump=D.nextBackJump,this.timestamps[U].curRepetition=G,this.timestamps[U].curRepetitionIteration=D.curRepetitionIteration}D=new TimestampTransform(R.CurrentEnrolledTimestamp.clone(),R.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(D)}R.moveToNext()}}}class TimestampTransform{constructor(R,F,D,G){this.from=R,this.to=F,this.curRepetition=D,this.curRepetitionIteration=G,this.nextBackJump=void 0,this.nextForwardJump=void 0}}class PartListEntry{constructor(R){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=R}get Visible(){return this.visible}set Visible(R){this.visible=R}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}class SourceMusicPart extends PartListEntry{constructor(R,F,D){super(R),this.musicSheet=R,this.startIndex=F,this.endIndex=D}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(R){this.parentRepetition=R}get AbsoluteTimestamp(){return Fraction$1.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(R){this.startIndex=R}setEndIndex(R){this.endIndex=R}}class Repetition extends PartListEntry{constructor(R,F=!1){super(R),this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.userNumberOfRepetitions=0,this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=R,this.virtualOverallRepetition=F}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(R){this.visibles=R}get DefaultNumberOfRepetitions(){let R=2;return this.virtualOverallRepetition&&(R=1),Math.max(R,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(R){this.userNumberOfRepetitions=R,this.repetitonIterationOrder=[];const F=this.userNumberOfRepetitions-this.NumberOfEndings;for(let D=1;D<=this.userNumberOfRepetitions;D++)D<=F?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(D-F)}getForwardJumpTargetForIteration(R){const F=this.repetitonIterationOrder[R-1];return this.endingIndexDict[F]?this.endingIndexDict[F].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(R,F){const D=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,F,F));this.endingParts.push(D);for(const G of R)try{this.endingIndexDict[G]=D,D.endingIndices.push(G),this.numberOfEndings0&&(G=1),U.Add(new Fraction$1(G,F)),U}}class MusicSheet$1{constructor(){this.idString="random idString, not initialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new MusicSheetErrors,this.staves=[],this.playbackDataDict=new Dictionary,this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new Fraction$1(0,1),this.soundTempos=new Map,this.playbackSettings=new PlaybackSettings,this.playbackSettings.rhythm=new Fraction$1(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new MusicPartManager(this),this.hasBPMInfo=!1}get SoundTempos(){return this.soundTempos}set SoundTempos(R){this.soundTempos=R}static getIndexFromStaff(R){return R.idInMusicSheet}get CurrentKeyInstruction(){return this.currentKeyInstruction}set CurrentKeyInstruction(R){this.currentKeyInstruction=R}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(R){this.sourceMeasures=R}get Repetitions(){return this.repetitions}set Repetitions(R){this.repetitions=R}get DynListStaves(){return this.dynListStaves}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(R){this.playbackSettings=R}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(R){this.drawErroneousMeasures=R}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(R){this.hasBeenOpenedForTheFirstTime=R}InitializeStartTempoInBPM(R){this.playbackSettings.BeatsPerMinute=R,this.userStartTempoInBPM=R}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(R){this.defaultStartTempoInBpm=R,this.InitializeStartTempoInBPM(R)}get Path(){return this.path}set Path(R){this.path=R}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(R){this.Title=new Label(R)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(R){this.Subtitle=new Label(R)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(R){this.Composer=new Label(R)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(R){this.Lyricist=new Label(R)}get Title(){return this.title}set Title(R){this.title=R}get Subtitle(){return this.subtitle}set Subtitle(R){this.subtitle=R}get Composer(){return this.composer}set Composer(R){this.composer=R}get Lyricist(){return this.lyricist}set Lyricist(R){this.lyricist=R}get Rules(){return this.rules||(log$2.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new EngravingRules),this.rules}set Rules(R){this.rules=R}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(R){this.selectionStart=R.clone(),this.currentEnrolledPosition=R.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(R){this.selectionEnd=R}set HasBPMInfo(R){this.hasBPMInfo=R}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(R){this.sourceMeasures.push(R),R.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let R=0,F=this.instruments.length;R0){const R=this.TimestampSortedTempoExpressionsList[0];if(R.InstantaneousTempo)return R.InstantaneousTempo.TempoInBpm;if(R.ContinuousTempo)return R.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(R){return log$2.info("MusicSheet.FirstMeasureNumber: ",R),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(R){return log$2.info("MusicSheet.LastMeasureNumber: ",R),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(R){this.currentEnrolledPosition=R.clone()}get Transpose(){return this.transpose}set Transpose(R){this.transpose=R}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(R){this.idString=R}getEnrolledSelectionStartTimeStampWorkaround(){const R=this.MusicPartManager.getIterator(this.SelectionStart);return Fraction$1.createFromFraction(R.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const R=this.getLastSourceMeasure();return Fraction$1.plus(R.AbsoluteTimestamp,R.Duration)}getSourceMeasureFromTimeStamp(R){for(let F=0,D=this.sourceMeasures.length;F0&&G.Voices[0].Visible&&R.push(G)}return R}}MusicSheet$1.defaultTitle="[no title given]";class LyricWord{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(R){for(let F=0,D=this.Syllables.length;F=0&&(this.syllableIndex=U)}get Text(){return this.text}set Text(R){this.text=R}get Word(){return this.word}get Parent(){return this.parent}set Parent(R){this.parent=R}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}}class LyricsReader{constructor(R){this.openLyricWords={},this.musicSheet=R}addLyricEntry(R,F){var D,G;if(R){const U=R;for(let W=0,q=U.length;W0)for(let fe=re;fe1&&(J=parseInt(ie[1],10))}catch{const re=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(re);continue}}let ne;if(K==="single"||K==="end"){if(this.openLyricWords[J]){this.currentLyricWord=this.openLyricWords[J];const ie=this.currentLyricWord.Syllables.length;ne=new LyricsEntry(j,J,this.currentLyricWord,F,ie),this.currentLyricWord.Syllables.push(ne),delete this.openLyricWords[J],this.currentLyricWord=void 0}else ne=new LyricsEntry(j,J,void 0,F);ne.extend=Y.element("extend")!==void 0}else if(K==="begin")this.openLyricWords[J]&&(delete this.openLyricWords[J],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[J]=this.currentLyricWord,ne=new LyricsEntry(j,J,this.currentLyricWord,F,0),this.currentLyricWord.Syllables.push(ne);else if(K==="middle")if(this.openLyricWords[J]){this.currentLyricWord=this.openLyricWords[J];const ie=this.currentLyricWord.Syllables.length;ne=new LyricsEntry(j,J,this.currentLyricWord,F,ie),this.currentLyricWord.Syllables.push(ne)}else ne=new LyricsEntry(j,J,void 0,F);ne&&(F.LyricsEntries[J]||(F.LyricsEntries.setValue(J,ne),(G=(D=F.ParentSourceStaffEntry)==null?void 0:D.VerticalContainerParent)!=null&&G.ParentMeasure&&(F.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),F.ParentVoice.Parent.LyricVersesNumbers[J]||F.ParentVoice.Parent.LyricVersesNumbers.push(J))}}}catch{const Z=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(Z);continue}}F.ParentVoice.Parent.LyricVersesNumbers=F.ParentVoice.Parent.LyricVersesNumbers.filter((W,q,Y)=>Y.indexOf(W)===q)}}}class Articulation{constructor(R,F){this.articulationEnum=R,this.placement=F}Equals(R){return R.articulationEnum===this.articulationEnum&&R.placement===this.placement}}class ArticulationReader{constructor(R){this.rules=R}getAccEnumFromString(R){switch(R){case"sharp":return AccidentalEnum.SHARP;case"flat":return AccidentalEnum.FLAT;case"natural":return AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return AccidentalEnum.DOUBLEFLAT;case"triple-sharp":return AccidentalEnum.TRIPLESHARP;case"triple-flat":return AccidentalEnum.TRIPLEFLAT;case"quarter-sharp":return AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return AccidentalEnum.QUARTERTONEFLAT;case"three-quarters-sharp":return AccidentalEnum.THREEQUARTERSSHARP;case"three-quarters-flat":return AccidentalEnum.THREEQUARTERSFLAT;case"slash-quarter-sharp":return AccidentalEnum.SLASHQUARTERSHARP;case"slash-sharp":return AccidentalEnum.SLASHSHARP;case"double-slash-flat":return AccidentalEnum.DOUBLESLASHFLAT;case"sori":return AccidentalEnum.SORI;case"koron":return AccidentalEnum.KORON;default:return AccidentalEnum.NONE}}addArticulationExpression(R,F){var D,G;if(R!==void 0&&R.elements().length>0){const U=R.elements();for(let W=0,q=U.length;W0&&F.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&F.Articulations.splice(0,0,J),K==="strongaccent"){const te=(G=Y==null?void 0:Y.attribute("type"))==null?void 0:G.value;te==="up"?J.articulationEnum=ArticulationEnum.marcatoup:te==="down"&&(J.articulationEnum=ArticulationEnum.marcatodown)}if(K==="detachedlegato"){const te=new Articulation(ArticulationEnum.staccato,j),ne=new Articulation(ArticulationEnum.tenuto,j);F.Articulations.push(te,ne)}if(!F.hasArticulation(J))switch(F.Articulations.push(J),J.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:F.DurationModifier=J;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:F.VolumeModifier=J;break;default:break}}}catch(Z){const j="Invalid note articulation.";log$2.debug("addArticulationExpression",j,Z);return}}}}addFermata(R,F){var U;let D=ArticulationEnum.fermata;R.attributes().length>0&&R.attribute("type")&&R.attribute("type").value==="inverted"&&(D=ArticulationEnum.invertedfermata);let G=PlacementEnum.Above;((U=R.attribute("placement"))==null?void 0:U.value)==="below"&&(G=PlacementEnum.Below),F.Articulations.push(new Articulation(D,G))}addTechnicalArticulations(R,F,D){var q,Y;const G={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(const K in G){if(!G.hasOwnProperty(K))continue;const Z=G[K],j=R.element(K);if(j){let Q;((q=j.attribute("placement"))==null?void 0:q.value)==="above"&&(Q=PlacementEnum.Above),((Y=j.attribute("placement"))==null?void 0:Y.value)==="below"&&(Q=PlacementEnum.Below);const J=new Articulation(Z,Q);F.hasArticulation(J)||F.Articulations.push(J)}}const U=R.element("fingering");if(U){const K=this.createTechnicalInstruction(U,D);K.type=TechnicalInstructionType.Fingering,D.Fingering=K,F.TechnicalInstructions.push(K)}const W=R.element("string");if(W){const K=this.createTechnicalInstruction(W,D);K.type=TechnicalInstructionType.String,D.StringInstruction=K,F.TechnicalInstructions.push(K)}}createTechnicalInstruction(R,F){const D=new TechnicalInstruction;D.sourceNote=F,D.value=R.value;const G=R.attribute("placement");return this.rules.FingeringPositionFromXML&&(D.placement=this.getPlacement(G)),D}getPlacement(R,F=PlacementEnum.NotYetDefined){if(F!==PlacementEnum.NotYetDefined)return F;if(R)switch(R.value){case"above":return PlacementEnum.Above;case"below":return PlacementEnum.Below;case"left":return PlacementEnum.Left;case"right":return PlacementEnum.Right;default:return PlacementEnum.NotYetDefined}else return PlacementEnum.NotYetDefined}addOrnament(R,F){if(R){let D;const G={"delayed-inverted-turn":OrnamentEnum.DelayedInvertedTurn,"delayed-turn":OrnamentEnum.DelayedTurn,"inverted-mordent":OrnamentEnum.InvertedMordent,"inverted-turn":OrnamentEnum.InvertedTurn,mordent:OrnamentEnum.Mordent,"trill-mark":OrnamentEnum.Trill,turn:OrnamentEnum.Turn};for(const U in G){if(!G.hasOwnProperty(U))continue;const W=R.element(U);if(W){D=new OrnamentContainer(G[U]);const q=W.attribute("placement");q&&q.value==="below"&&(D.placement=PlacementEnum.Below)}}if(D){const U=R.elements("accidental-mark");if(U){let W=PlacementEnum.Below,q=AccidentalEnum.NONE;const Y=U;for(let K=0,Z=Y.length;K0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}finalizeReadingMeasure(){this.graceVoiceEntriesTempList.length>0&&this.currentNormalVoiceEntry!==void 0&&this.currentNormalVoiceEntry.GraceVoiceEntriesAfter.concat(this.graceVoiceEntriesTempList),this.graceVoiceEntriesTempList=[],this.pluginManager.processVoiceMeasureReadPlugins(this.currMeasureVoiceEntries,this.activeKey,this.activeRhythm),this.currMeasureVoiceEntries.length=0,this.openBeams.length>1&&this.handleOpenBeam()}read(R,F,D,G,U,W,q,Y,K,Z,j,Q,J,te,ne,ie,re,oe,le,fe,he,ge){this.currentStaffEntry=q,this.currentMeasure=Y;try{this.currentNote=W?this.addRestNote(R.element("rest"),F,G,U,J,te,le):this.addSingleNote(R,F,G,D,U,j,Q,J,te,ne,ie,re,oe,le,he,ge),this.currentNote.DotsXml=fe;const ce=R.elements("lyric");this.lyricsReader!==void 0&&ce&&(this.lyricsReader.addLyricEntry(ce,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let me=!1;const ye=R.element("notations");if(ye){this.articulationReader&&this.readArticulations(ye,this.currentVoiceEntry,this.currentNote);const ve=ye.elements("slur");this.slurReader!==void 0&&ve.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(ve,this.currentNote);const pe=ye.elements("tuplet");pe.length>0&&(this.openTupletNumber=this.addTuplet(R,pe),me=!0);const be=ye.element("arpeggiate");if(be!==void 0){let Be;if(this.currentVoiceEntry.Arpeggio)Be=this.currentVoiceEntry.Arpeggio;else{let Ae=!1;for(const Pe of this.currentStaffEntry.VoiceEntries)if(Pe.Arpeggio){Ae=!0,Be=Pe.Arpeggio;break}if(!Ae){let Pe=ArpeggioType.ARPEGGIO_DIRECTIONLESS;const Ie=be.attribute("direction");if(Ie)switch(Ie.value){case"up":Pe=ArpeggioType.ROLL_UP;break;case"down":Pe=ArpeggioType.ROLL_DOWN;break;default:Pe=ArpeggioType.ARPEGGIO_DIRECTIONLESS}Be=new Arpeggio(this.currentVoiceEntry,Pe),this.currentVoiceEntry.Arpeggio=Be}}Be.addNote(this.currentNote)}const xe=ye.elements("tied");xe.length>0&&this.addTie(xe,K,Z,TieTypes.SIMPLE);const ue=ye.elements("slide");ue.length>0&&this.addTie(ue,K,Z,TieTypes.SLIDE);const _e=ye.element("technical");if(_e){const Be=_e.elements("hammer-on");Be.length>0&&this.addTie(Be,K,Z,TieTypes.HAMMERON);const Ae=_e.elements("pull-off");Ae.length>0&&this.addTie(Ae,K,Z,TieTypes.PULLOFF)}}R.element("time-modification")!==void 0&&!me&&this.handleTimeModificationNode(R)}catch(ce){log$2.warn(ce);const me=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(me),this.musicSheet.SheetErrors.pushMeasureError(ce)}return this.currentNote}checkForStaffEntryLink(R,F,D,G){const U=new StaffEntryLink(this.currentVoiceEntry);U.LinkStaffEntries.push(D),D.Link=U;const W=this.currentVoiceEntry.Timestamp.clone(),q=G.getVerticalContainerByTimestamp(W);return D=q.StaffEntries[R],D||(D=new SourceStaffEntry(q,F),q.StaffEntries[R]=D),D.VoiceEntries.push(this.currentVoiceEntry),U.LinkStaffEntries.push(D),D.Link=U,D}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const R=this.openTieDict;for(const F in R)if(R.hasOwnProperty(F)){const D=R[F];Fraction$1.plus(D.StartNote.ParentStaffEntry.Timestamp,D.Duration).lt(D.StartNote.SourceMeasure.Duration)&&delete R[F]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(R,F,D){const G=R.element("articulations");G&&this.articulationReader.addArticulationExpression(G,F);const U=R.element("fermata");U&&this.articulationReader.addFermata(U,F);const W=R.element("technical");W&&this.articulationReader.addTechnicalArticulations(W,F,D);const q=R.element("ornaments");q&&this.articulationReader.addOrnament(q,F)}addSingleNote(R,F,D,G,U,W,q,Y,K,Z,j,Q,J,te,ne,ie){let re=0,oe,le=AccidentalEnum.NONE,fe=NoteEnum.C,he=NoteEnum.C,ge=0,ce=0,me,ye,ve;const pe=R.elements();for(let Ie=0,Ce=pe.length;Ie0&&this.openBeams.last().ExtendedNoteList.push(te),te}addNoteInfo(R,F,D,G,U,W,q,Y,K){R.NoteTypeXml=F,R.PrintObject=D,R.IsCueNote=G,R.NormalNotes=U,R.displayStepUnpitched=W,R.displayOctaveUnpitched=q,R.NoteheadColorXml=Y,R.NoteheadColor=Y}createBeam(R,F){var D;try{const G=R.element("beam");let U;if(G!==void 0&&G.hasAttributes&&(U=G.attribute("number")),U){let W=parseInt(U.value,10);const q=R.elements("beam"),Y=q[0].value;q&&(Y==="begin"?(W===((D=this.openBeams.last())==null?void 0:D.BeamNumber)?(this.beamNumberOffset++,W+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(W,this.beamNumberOffset))):W+=this.beamNumberOffset);let K=!1;if(!(W>0&&W<=this.openBeams.length)||!this.openBeams[W-1]){log$2.debug("[OSMD] invalid beamnumber");return}for(let Z=0,j=this.openBeams[W-1].Notes.length;Z1){let G=R.element("time-modification");G&&(G=G.element("actual-notes"));const U=F;for(let W=0,q=U.length;W1&&this.openTupletNumber--),this.tupletDict[j]=J;const ne=[];ne.push(this.currentNote),J.Notes.push(ne),J.Fractions.push(this.getTupletNoteDurationFromType(R)),this.currentNote.NoteTuplet=J,this.openTupletNumber=j}else if(Z.value==="stop"){let j=1;Y.attribute("number")&&(j=parseInt(Y.attribute("number").value,10));const Q=this.tupletDict[j];if(Q){const J=Y.attribute("placement");J&&(J.value==="below"?Q.tupletLabelNumberPlacement=PlacementEnum.Below:Q.tupletLabelNumberPlacement=PlacementEnum.Above,Q.PlacementFromXml=!0);const te=[];if(te.push(this.currentNote),Q.Notes.push(te),!Q.PlacementFromXml){let ne=!1;for(const ie of Q.Notes){for(const re of ie)if(!re.isRest()){re.StemDirectionXml===StemDirectionType.Down?Q.tupletLabelNumberPlacement=PlacementEnum.Below:Q.tupletLabelNumberPlacement=PlacementEnum.Above,ne=!0;break}if(ne)break}}Q.Fractions.push(this.getTupletNoteDurationFromType(R)),this.currentNote.NoteTuplet=Q,delete this.tupletDict[j],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(F[0]){const G=F[0];if(G.hasAttributes){const U=G.attribute("type").value;let W=1;G.attribute("number")&&(W=parseInt(G.attribute("number").value,10));const q=isNaN(W),Y=G.attribute("bracket");if(Y&&Y.value==="yes"&&(D=!0),U==="start"){let K=0,Z=R.element("time-modification");if(Z&&(Z=Z.element("actual-notes")),Z&&(K=parseInt(Z.value,10),isNaN(K))){const te=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(te),new MusicSheetReadingException(te)}q&&(this.openTupletNumber++,W=this.openTupletNumber);let j=this.tupletDict[W];j||(j=this.tupletDict[W]=new Tuplet(K,D),j.tupletLabelNumberPlacement=PlacementEnum.Above);const Q=G.attribute("placement");Q&&(Q.value==="below"?j.tupletLabelNumberPlacement=PlacementEnum.Below:j.tupletLabelNumberPlacement=PlacementEnum.Above,j.PlacementFromXml=!0);const J=[];J.push(this.currentNote),j.Notes.push(J),j.Fractions.push(this.getTupletNoteDurationFromType(R)),this.currentNote.NoteTuplet=j,this.openTupletNumber=W}else if(U==="stop"){q&&(W=this.openTupletNumber);const K=this.tupletDict[this.openTupletNumber];if(K){const Z=G.attribute("placement");Z&&(Z.value==="below"?K.tupletLabelNumberPlacement=PlacementEnum.Below:K.tupletLabelNumberPlacement=PlacementEnum.Above,K.PlacementFromXml=!0);const j=[];if(j.push(this.currentNote),K.Notes.push(j),!K.PlacementFromXml){let Q=!1;for(const J of K.Notes){for(const te of J)if(!te.isRest()){te.StemDirectionXml===StemDirectionType.Down?K.tupletLabelNumberPlacement=PlacementEnum.Below:K.tupletLabelNumberPlacement=PlacementEnum.Above,Q=!0;break}if(Q)break}}K.Fractions.push(this.getTupletNoteDurationFromType(R)),this.currentNote.NoteTuplet=K,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[W]}}}}return this.openTupletNumber}handleTimeModificationNode(R){if(this.tupletDict[this.openTupletNumber])try{const F=this.tupletDict[this.openTupletNumber],D=CollectionUtil.last(F.Notes),G=D[0].ParentVoiceEntry;let U;G.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?U=D:(U=[],F.Notes.push(U),F.Fractions.push(this.getTupletNoteDurationFromType(R))),U.push(this.currentNote),this.currentNote.NoteTuplet=F}catch(F){const D=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(D),F}else if(this.currentVoiceEntry.Notes.length>0){const F=this.currentVoiceEntry.Notes[0];if(F.NoteTuplet){const D=F.NoteTuplet;CollectionUtil.last(D.Notes).push(this.currentNote),this.currentNote.NoteTuplet=D}}}addTie(R,F,D,G){if(R){if(R.length===1){const U=R[0];if(U!==void 0&&U.attributes()){const W=this.getTieDirection(U),q=U.attribute("type").value;try{if(q==="start"){const Y=this.findCurrentNoteInTieDict(this.currentNote);Y<0&&delete this.openTieDict[Y];const K=this.getNextAvailableNumberForTie(),Z=new Tie(this.currentNote,G);this.openTieDict[K]=Z,Z.TieNumber=K,Z.TieDirection=W}else if(q==="stop"){const Y=this.findCurrentNoteInTieDict(this.currentNote),K=this.openTieDict[Y];K&&(K.AddNote(this.currentNote),delete this.openTieDict[Y])}}catch{const K=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(K)}}}else if(R.length===2){const U=this.findCurrentNoteInTieDict(this.currentNote);if(U>=0){const W=this.openTieDict[U];W.AddNote(this.currentNote);for(const q of R)if(q.attribute("type").value==="start"){const K=this.getTieDirection(q);W.NoteIndexToTieDirection[W.Notes.length-1]=K}}}}}getTieDirection(R){let F=PlacementEnum.NotYetDefined;const D=R.attribute("placement");D&&(D.value==="above"?F=PlacementEnum.Above:D.value==="below"&&(F=PlacementEnum.Below));const G=R.attribute("orientation");return G&&(G.value==="over"?F=PlacementEnum.Above:G.value==="under"&&(F=PlacementEnum.Below)),F}getNextAvailableNumberForTie(){const R=Object.keys(this.openTieDict);if(R.length===0)return 1;R.sort((F,D)=>+F-+D);for(let F=0;F0?G.RealValue>0?(K=Fraction$1.multiply(Fraction$1.minus(G,U),K),this.directionTimestamp=Fraction$1.plus(K,G)):this.directionTimestamp=Fraction$1.createFromFraction(K):this.offsetDivisions<0&&(G.RealValue>0?(K=Fraction$1.multiply(Fraction$1.minus(G,U),K),this.directionTimestamp=Fraction$1.minus(G,K)):this.directionTimestamp=Fraction$1.createFromFraction(K));const Z=R.attribute("placement");if(Z)try{const j=Z.value;j==="below"?this.placement=PlacementEnum.Below:j==="above"&&(this.placement=PlacementEnum.Above)}catch(j){const Q=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",Q,j),this.musicSheet.SheetErrors.pushMeasureError(Q),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{const j=R.element("direction-type");if(j){const Q=j.element("dynamics");if(Q){const ie=Q.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read dynamics y pos")}const J=j.element("wedge");if(J){const ie=J.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read wedge y pos")}const te=j.element("words");if(te){const ie=te.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read words y pos")}const ne=j.element("rehearsal");if(ne){const ie=ne.attribute("default-y");ie&&this.readExpressionPlacement(ie,"read rehearsal pos")}}}catch(j){const Q=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");log$2.debug("ExpressionReader.readExpressionParameters",Q,j),this.musicSheet.SheetErrors.pushMeasureError(Q),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(F.Staves.length>1?this.placement=PlacementEnum.Below:F.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}read(R,F,D,G=void 0,U=0){let W=!1,q=!1;const Y=R.element("sound");if(Y){const j=Y.attribute("tempo"),Q=Y.attribute("dynamics");if(j){const J=j.value.match(/^(\d+)(\.\d+)?$/);(J==null?void 0:J.length)>0?this.soundTempo=Math.round(Number.parseFloat(j.value)):(log$2.info("invalid xml tempo: "+j.value),this.soundTempo=100),F.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,W=!0}if(Q){const J=Q.value.match(/\d+/);this.soundDynamic=J!==void 0?parseInt(J[0],10):100,q=!0}}const K=R.element("direction-type");if(!K)return;let Z=K.element("metronome");if(Z){F.metronomeNoteIndex=U;const j=Z.element("beat-unit"),Q=Z.element("beat-unit-dot")!==void 0,J=Z.element("per-minute");if(j!==void 0&&J){Z.hasAttributes&&Z.attribute("default-x")!==void 0&&(this.directionTimestamp=Fraction$1.createFromFraction(D));const ne=parseFloat(J.value);this.createNewTempoExpressionIfNeeded(F);const ie=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,ne,this.currentMultiTempoExpression,!0);ie.parentMeasure=F,this.soundTempo=ne,F.TempoInBPM=this.soundTempo*(Q?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),F.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,ie.dotted=Q,ie.beatUnit=j.value,this.currentMultiTempoExpression.addExpression(ie,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(Z=K.element("dynamics"),Z){const j=R.element("notations")!==void 0;this.interpretInstantaneousDynamics(Z,F,D,j);return}if(Z=K.element("words"),Z){const j=K.elements("words");let Q="";for(const J of j)Q+=J.value;if(Z.value=Q,W||isSpeedKeyword(Z.value)||isSpeedHiddenKeyword(Z.value)){this.createNewTempoExpressionIfNeeded(F),this.currentMultiTempoExpression.CombinedExpressionsText=Z.value,(isSpeedKeyword(Z.value)||isSpeedHiddenKeyword(Z.value))&&(Z.value=void 0);const J=new InstantaneousTempoExpression(Z.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(J,"")}else q||this.interpretWords(Z,F,D);return}if(Z=K.element("wedge"),Z){this.interpretWedge(Z,F,G,F.MeasureNumber);return}if(Z=K.element("rehearsal"),Z){this.interpretRehearsalMark(Z,F,D,F.MeasureNumber);return}}closeOpenExpressions(R,F){for(const D of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(R,D.NumberXml,F),this.closeOpenContinuousDynamic(D,R,F);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(R.AbsoluteTimestamp,F))}addOctaveShift(R,F,D){var q;let G=1;const U=R.element("staff");if(U)try{G=parseInt(U.value,10)}catch(Y){const K=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(K),G=1,log$2.debug("ExpressionReader.addOctaveShift",K,Y)}const W=R.element("direction-type");if(W){const Y=W.element("octave-shift"),K=this.readPlacement(R);if(Y!==void 0&&Y.hasAttributes)try{const Z=this.readNumber(Y);if(Y.attribute("size")){const j=parseInt(Y.attribute("size").value,10);let Q=0;j===8?Q=1:j===15&&(Q=2);let J=(q=Y.attribute("type"))==null?void 0:q.value;if(J||(K===PlacementEnum.Above?J="down":K===PlacementEnum.Below&&(J="up")),J==="up"||J==="down"){const te=new OctaveShift(J,Q);te.StaffNumber=G,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(F,Z),this.getMultiExpression.OctaveShiftStart=te,te.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=te}else if(J==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(F,this.openOctaveShift.numberXml,D);const te=this.getMultiExpression;te.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else J||log$2.debug("octave-shift missing type in xml")}}catch(Z){const j=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(j),log$2.debug("ExpressionReader.addOctaveShift",j,Z)}}}addPedalMarking(R,F,D){var U,W,q,Y;const G=R.element("direction-type");if(G){const K=G.element("pedal");if(K!==void 0&&K.hasAttributes){let Z=!1,j=!1;try{switch(((U=K.attribute("line"))==null?void 0:U.value)==="yes"?j=!0:((W=K.attribute("line"))==null?void 0:W.value)==="no"&&(j=!1,Z=!0),((q=K.attribute("sign"))==null?void 0:q.value)==="yes"?Z=!0:((Y=K.attribute("sign"))==null?void 0:Y.value)==="no"&&(Z=!1,j=!0),K.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(F),this.createNewMultiExpressionIfNeeded(F,-1),this.openPedal=new Pedal(j,Z),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(F);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(F,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(F,-1),this.openPedal=new Pedal(j,Z),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(Q){const J=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(J),log$2.debug("ExpressionReader.addPedalMarking",J,Q)}}}}endOpenPedal(R){this.createNewMultiExpressionIfNeeded(R,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(R,F,D,G){if(R&&R.hasAttributes)try{switch(R.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(F,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(F,-1,D),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0);break;case"continue":break;default:break}}catch(U){const W=ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(W),log$2.debug("ExpressionReader.addWavyLine",W,U)}}initialize(){this.placement=PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(R){var D;const F=(D=R.attribute("placement"))==null?void 0:D.value;return F==="above"?PlacementEnum.Above:F==="below"?PlacementEnum.Below:PlacementEnum.NotYetDefined}readExpressionPlacement(R,F){try{const D=parseInt(R.value,10);D<0?this.placement=PlacementEnum.Below:D>0&&(this.placement=PlacementEnum.Above)}catch(D){log$2.debug("ExpressionReader.readExpressionParameters",F,D)}}interpretInstantaneousDynamics(R,F,D,G){if(R.hasElements){R.hasAttributes&&R.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(D));const U=this.readNumber(R);let W=R.elements()[0].name;if(W==="other-dynamics"&&(W=R.elements()[0].value),W){G?this.createNewMultiExpressionIfNeeded(F,U,Fraction$1.createFromFraction(D)):this.createNewMultiExpressionIfNeeded(F,U);const q=new InstantaneousDynamicExpression(W,this.soundDynamic,this.placement,this.staffNumber,F);q.InMeasureTimestamp=D.clone(),this.getMultiExpression.addExpression(q,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=q.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(W,0,PlacementEnum.NotYetDefined,1,F)}}}interpretWords(R,F,D){const G=R.value;let U;const W=R.attribute("font-style");if(W&&W.value==="italic"&&(U=FontStyles.Italic),G.length>0){if(R.hasAttributes&&R.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(D)),this.checkIfWordsNodeIsRepetitionInstruction(G))return;this.fillMultiOrTempoExpression(G,F,D,U),this.initialize()}}readNumber(R){var G;let F=1;const D=(G=R.attribute("number"))==null?void 0:G.value;return D&&(F=Number.parseInt(D,10)),F}interpretWedge(R,F,D,G){var W,q;R!==void 0&&R.hasAttributes&&R.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(D));const U=this.readNumber(R);((q=(W=R.attribute("type"))==null?void 0:W.value)==null?void 0:q.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(F,U,D):this.createNewMultiExpressionIfNeeded(F,U),this.addWedge(R,F,D),this.initialize()}interpretRehearsalMark(R,F,D,G){F.rehearsalExpression=new RehearsalExpression(R.value,this.placement)}createNewMultiExpressionIfNeeded(R,F,D=void 0){D||(D=this.directionTimestamp);let G=this.getMultiExpression;return(!G||G&&(G.SourceMeasureParent!==R||G.numberXml!==F||G.SourceMeasureParent===R&&G.Timestamp!==D))&&(this.getMultiExpression=G=new MultiExpression(R,Fraction$1.createFromFraction(D)),R.StaffLinkedExpressions[this.globalStaffIndex].push(G)),G}createNewTempoExpressionIfNeeded(R){(!this.currentMultiTempoExpression||this.currentMultiTempoExpression.SourceMeasureParent!==R||this.currentMultiTempoExpression.Timestamp!==this.directionTimestamp)&&(this.currentMultiTempoExpression=new MultiTempoExpression(R,Fraction$1.createFromFraction(this.directionTimestamp)),R.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(R,F,D){if(R!==void 0&&R.hasAttributes){const G=this.readNumber(R),U=R.attribute("type").value.toLowerCase();try{if(U==="crescendo"||U==="diminuendo"){const W=new ContinuousDynamicExpression(ContDynamicEnum[U],this.placement,this.staffNumber,F,this.activeInstantaneousDynamic,G);this.openContinuousDynamicExpressions.push(W);let q=this.getMultiExpression;q||(q=this.createNewMultiExpressionIfNeeded(F,G)),q.StartingContinuousDynamic=W,W.StartMultiExpression=q,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===W.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(U==="stop")for(const W of this.openContinuousDynamicExpressions)W.NumberXml===G&&W.NumberXml===G&&this.closeOpenContinuousDynamic(W,F,D)}catch(W){const q="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(q),log$2.debug("ExpressionReader.addWedge",q,W)}}}fillMultiOrTempoExpression(R,F,D,G){if(!R)return;const U=R.trim();this.createExpressionFromString("",U,F,D,R,G)}createExpressionFromString(R,F,D,G,U,W){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(F)||ContinuousTempoExpression.isInputStringContinuousTempo(F)){if(D.TempoExpressions.length>0)for(let Z=0,j=D.TempoExpressions.length;Z0)for(let Z=0,j=D.TempoExpressions.length;Z0&&!this.hasDigit(F)&&this.globalStaffIndex>0){if(Q.EntriesList[0].label.indexOf(F)>=0)return!1;break}}let Y=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(Y=TextAlignmentEnum.LeftBottom);const K=new UnknownExpression(F,this.placement,Y,this.staffNumber);return K.fontStyle=W,q.addExpression(K,R),!1}closeOpenContinuousDynamic(R,F,D){if(!R)return;const G=R.NumberXml;R.EndMultiExpression=this.createNewMultiExpressionIfNeeded(F,G,D),R.StartMultiExpression.EndingContinuousDynamic=R,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(U=>U!==R)}closeOpenContinuousTempo(R){this.openContinuousTempoExpression.AbsoluteEndTimestamp=R,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(R){return R=R.trim().toLowerCase(),R==="coda"||R==="tocoda"||R==="to coda"||R==="fine"||R==="d.c."||R==="dacapo"||R==="da capo"||R==="d.s."||R==="dalsegno"||R==="dal segno"||R==="d.c. al fine"||R==="d.s. al fine"||R==="d.c. al coda"||R==="d.s. al coda"}hasDigit(R){return/\d/.test(R)}}class Slur{constructor(){}get StartNote(){return this.startNote}set StartNote(R){this.startNote=R}get EndNote(){return this.endNote}set EndNote(R){this.endNote=R}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let R=0,F=this.startNote.NoteSlurs.length;R0){const G=D.attribute("type").value;let U=1;try{D.attribute("number")&&(U=parseInt(D.attribute("number").value,10))}catch(K){log$2.debug("VoiceGenerator.addSlur number: ",K)}let W=PlacementEnum.NotYetDefined;const q=D.attribute("placement");q&&q.value&&(q.value==="above"?W=PlacementEnum.Above:q.value==="below"&&(W=PlacementEnum.Below));const Y=D.attribute("orientation");if(Y&&Y.value&&(Y.value==="over"?W=PlacementEnum.Above:Y.value==="under"&&(W=PlacementEnum.Below)),G==="start"){let K=this.openSlurDict[U];K||(K=new Slur,this.openSlurDict[U]=K),K.StartNote=F,K.PlacementXml=W}else if(G==="stop"){const K=this.openSlurDict[U];K&&(K.EndNote=F,F.checkForDoubleSlur(K)||(F.NoteSlurs.push(K),K.StartNote.NoteSlurs.push(K)),delete this.openSlurDict[U])}}}}catch{const G=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(G)}}}class InstrumentReader{constructor(R,F,D,G){this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.openChordSymbolContainers=[],this.soundTempos=new Map,this.xmlNotes=[],this.repetitionInstructionReader=F,this.xmlMeasureList=D,this.musicSheet=G.GetMusicSheet,this.instrument=G,this.activeClefs=new Array(G.Staves.length),this.activeClefsHaveBeenInitialized=new Array(G.Staves.length);for(let U=0;U=this.xmlMeasureList.length)return!1;this.currentMeasure=R,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(R,this.currentXmlMeasureIndex);let G=new Fraction$1(0,1),U=new Fraction$1(0,1),W=!1;this.maxTieNoteFraction=new Fraction$1(0,1);let q=!1;const Y=[];try{const le=this.xmlMeasureList[this.currentXmlMeasureIndex],fe=le.elements();if(R.Rules.UseXMLMeasureNumbers&&!Number.isInteger(R.MeasureNumberXML)){const ge=parseInt((K=le.attribute("number"))==null?void 0:K.value,10);Number.isInteger(ge)&&(R.MeasureNumberXML=ge)}let he;for(let ge=0;ge0&&(he=fe[ge-1]),ce.name==="print"){const me=ce.attribute("new-system");(me==null?void 0:me.value)==="yes"&&(R.printNewSystemXml=!0);const ye=ce.attribute("new-page");(ye==null?void 0:ye.value)==="yes"&&(R.printNewPageXml=!0)}else if(ce.name==="note"){ce.element("grace")||(this.xmlNotes.push(ce),Y.push(ce));let me=!0;((Z=ce.attribute("print-object"))==null?void 0:Z.value)==="no"&&(me=!1);let ye=1;this.instrument.Staves.length>1&&ce.element("staff")&&(ye=parseInt(ce.element("staff").value,10),isNaN(ye)&&(log$2.debug("InstrumentReader.readNextXmlMeasure.get staff number"),ye=1)),this.currentStaff=this.instrument.Staves[ye-1];const ve=ce.element("chord")!==void 0;if(ce.element("voice")){const Fe=parseInt(ce.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(Fe,ye-1)}else(!ve||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,ye-1));let pe=0,be=new Fraction$1(0,1),xe=2,ue,_e=!1;if(ce.element("duration")){if(pe=parseInt(ce.element("duration").value,10),isNaN(pe)){const Fe=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(Fe),log$2.debug("InstrumentReader.readNextXmlMeasure",Fe);continue}else if(be=new Fraction$1(pe,4*this.divisions),pe===0?be=this.getNoteDurationFromTypeNode(ce):ue=this.getNoteDurationFromTypeNode(ce),ce.element("time-modification")){be=this.getNoteDurationForTuplet(ce);const Fe=ce.element("time-modification");Fe!=null&&Fe.element("normal-notes")&&(xe=parseInt(Fe.element("normal-notes").value,10)),_e=!0}}const Be=ce.element("rest")!==void 0,Ae=ce.element("notations"),Pe=ce.element("grace")!==void 0||pe===0||ve&&q;let Ie=!1,Ce=!1;if(Pe){const Fe=ce.element("duration"),He=ce.element("grace");He&&He.attributes()&&He.attribute("slash")&&He.attribute("slash").value==="yes"&&(Ie=!0),Fe||(be=this.getNoteDurationFromTypeNode(ce));const Qe=ce.element("notations");Qe&&Qe.element("slur")&&(Ce=!0)}let Te=!1;ce.element("cue")&&(Te=!0);const Ne=ce.element("type");let Ge=NoteType.UNDEFINED;if(Ne){const Fe=Ne.attribute("size");(Fe==null?void 0:Fe.value)==="cue"&&(Te=!0),Ge=NoteTypeHandler.StringToNoteType(Ne.value)}let ke=StemDirectionType.Undefined,$e;const We=ce.element("stem");if(We){switch(We.value){case"down":ke=StemDirectionType.Down;break;case"up":ke=StemDirectionType.Up;break;case"double":ke=StemDirectionType.Double;break;case"none":ke=StemDirectionType.None;break;default:ke=StemDirectionType.Undefined}const Fe=We.attribute("color");Fe&&($e=this.parseXmlColor(Fe.value))}let Ve=0,qe="",et="";if(Ae){const Fe=Ae.element("ornaments");if(Fe){const Qe=Fe.element("tremolo");if(Qe){const Xe=Qe.attribute("type");if(qe=Xe.value,Xe){const rt=parseInt(Qe.value,10);rt>0&&(Ve=rt),(Xe.value==="start"||Xe.value==="stop")&&(be=new Fraction$1(parseInt(ce.element("duration").value,10),4*this.divisions))}}const tt=Fe.elements("wavy-line");if(tt!==void 0)for(const Xe of tt){const rt=this.expressionReaders[this.readExpressionStaffNumber(ce)-1];rt&&(rt.readExpressionParameters(Xe,this.instrument,this.divisions,G,U,this.currentMeasure.MeasureNumber,!1),rt.addWavyLine(Xe,this.currentMeasure,G,U))}}const He=Ae.element("glissando");He&&He.attribute("type").value==="start"&&(et="start")}let ot;const ft=ce.element("notehead");if(ft){const Fe=ft.attribute("color");Fe&&(ot=this.parseXmlColor(Fe.value))}let lt;const Ee=ce.attribute("color");Ee&&(lt=this.parseXmlColor(Ee.value),ot||(ot=lt),$e||($e=lt));let je=G.clone();ve&&(je=U.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(je,this.inSourceMeasureInstrumentIndex+ye-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!ve&&!Pe&&!q||Pe&&!q||Pe&&!ve||!Pe&&q)&&this.currentVoiceGenerator.createVoiceEntry(je,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,Pe,Ie,Ce),!Pe&&!ve&&(U=G.clone(),G.Add(be)),ve&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+ye-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const Ke=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new Fraction$1(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,Ke),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!_e&&!Pe&&(be=new Fraction$1(pe,4*this.divisions));const Oe=ce.elements("dot").length;if(this.currentVoiceGenerator.read(ce,be,ue,Ge,xe,Be,this.currentStaffEntry,this.currentMeasure,F,this.maxTieNoteFraction,ve,D,me,Te,Pe,ke,Ve,$e,ot,Oe,qe,et),Ae!==void 0&&Ae.element("dynamics")){const Fe=this.expressionReaders[this.readExpressionStaffNumber(ce)-1];Fe&&(Fe.readExpressionParameters(ce,this.instrument,this.divisions,G,U,this.currentMeasure.MeasureNumber,!1),Fe.read(ce,this.currentMeasure,U,void 0,Y.length))}q=Pe}else if(ce.name==="attributes"){const me=ce.element("divisions");if(me&&(this.divisions=parseInt(me.value,10),isNaN(this.divisions))){const pe=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(log$2.debug("InstrumentReader.readNextXmlMeasure",pe),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(pe+this.instrument.Name);else throw W=!0,new MusicSheetReadingException(pe+this.instrument.Name)}if(!ce.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const pe=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(pe+this.instrument.Name);else throw W=!0,new MusicSheetReadingException(pe+this.instrument.Name)}this.addAbstractInstruction(ce,D,he,G.clone()),G.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],ce)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],ce)&&this.saveClefInstructionAtEndOfMeasure();const ye=ce.elements("staff-details");for(const pe of ye){const be=pe.element("staff-lines");if(be){let xe=1;const ue=pe.attribute("number");ue&&(xe=parseInt(ue.value,10)),this.instrument.Staves[xe-1].StafflineCount=parseInt(be.value,10)}}const ve=ce.element("measure-style");if(ve){const pe=ve.element("multiple-rest");if(pe){const be=pe.value;let xe=0;try{xe=Number.parseInt(be,10),R.multipleRestMeasures!==void 0&&xe!==R.multipleRestMeasures?R.multipleRestMeasures=0:(R.multipleRestMeasures=xe,this.currentMultirestStartMeasure=R,this.followingMultirestMeasures=xe+1)}catch(ue){console.log("multirest parse error: "+ue)}}}}else if(ce.name==="forward"){const me=parseInt(ce.element("duration").value,10);G.Add(new Fraction$1(me,4*this.divisions))}else if(ce.name==="backup"){const me=parseInt(ce.element("duration").value,10);G.Sub(new Fraction$1(me,4*this.divisions)),G.IsNegative()&&(G=new Fraction$1(0,1)),U.Sub(new Fraction$1(me,4*this.divisions)),U.IsNegative()&&(U=new Fraction$1(0,1))}else if(ce.name==="direction"){const me=ce.elements("direction-type"),ye=ce.element("direction-type");let ve=Math.min(1,G.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(ve/=this.activeRhythm.Rhythm.RealValue);let pe=!1;if(this.repetitionInstructionReader&&(pe=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(ye,ve)),!pe){let be=this.expressionReaders[0];const xe=this.readExpressionStaffNumber(ce)-1;if(xeBe==null?void 0:Be.toLocaleLowerCase()).includes((j=ue.value)==null?void 0:j.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(Q=ue.value)==null?void 0:Q.toLocaleLowerCase(),startXmlNoteIndex:Y.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),ue.value.startsWith(GRADIENT_SPEED_CLOSE_TAG)&&((J=this.currentGradualChangeMeasure)==null?void 0:J.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex}),((te=ue.value)==null?void 0:te.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((ne=this.currentGradualChangeMeasure)==null?void 0:ne.speedInfo))){const{endXmlNoteIndex:Be,resetXmlNoteIndex:Ae,endMeasureListIndex:Pe}=this.currentGradualChangeMeasure.speedInfo;Ae===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:Be||this.xmlNotes.length,endMeasureListIndex:Pe||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}if(me.find(_e=>_e.element("metronome"))&&((ie=this.currentGradualChangeMeasure)==null?void 0:ie.speedInfo)){const{endXmlNoteIndex:_e,resetXmlNoteIndex:Be,endMeasureListIndex:Ae}=this.currentGradualChangeMeasure.speedInfo;Be===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:_e||this.xmlNotes.length,endMeasureListIndex:Ae||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}be.readExpressionParameters(ce,this.instrument,this.divisions,G,U,this.currentMeasure.MeasureNumber,!1),be.read(ce,this.currentMeasure,G,U.clone(),Y.length)}}}else if(ce.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(ce)&&(this.currentMeasure.HasEndLine=!0);const me=ce.attribute("location");if(ge===fe.length-1||me&&me.value==="right"){const ve=(re=ce.element("bar-style"))==null?void 0:re.value;if(ve&&(this.currentMeasure.endingBarStyleXml=ve,this.currentMeasure.endingBarStyleEnum=SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(ve),(oe=this.currentGradualChangeMeasure)!=null&&oe.speedInfo)){const{endXmlNoteIndex:pe,resetXmlNoteIndex:be,endMeasureListIndex:xe}=this.currentGradualChangeMeasure.speedInfo;be===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:pe||this.xmlNotes.length,endMeasureListIndex:xe||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(ce.name==="sound")try{if(ce.attribute("tempo")){const me=parseFloat(ce.attribute("tempo").value);ce.element("offset")&&(this.soundTempos.has(this.currentXmlMeasureIndex)||this.soundTempos.set(this.currentXmlMeasureIndex,[]),this.soundTempos.get(this.currentXmlMeasureIndex).push(me)),this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=me,this.musicSheet.HasBPMInfo=!0)}}catch(me){log$2.debug("InstrumentReader.readTempoInstruction",me)}else ce.name==="harmony"&&this.openChordSymbolContainers.push(ChordSymbolReader.readChordSymbol(ce,this.musicSheet,this.activeKey))}for(const ge in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(ge)&&this.voiceGeneratorsDict[ge].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let ge=0;ge{this.voiceGeneratorsDict[ge].finalizeReadingMeasure()}),this.musicSheet.HasBPMInfo?R.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120,this.currentMeasure.TempoInBPM||(this.currentMeasure.TempoInBPM=this.musicSheet.DefaultStartTempoInBpm)}catch(le){if(W)throw new MusicSheetReadingException(le.Message);const fe=ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(fe),log$2.debug("InstrumentReader.readNextXmlMeasure",fe,le)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}parseXmlColor(R){if(!!R)return R.length===7?R:R.length===9?"#"+R.substr(3):void 0}doCalculationsAfterDurationHasBeenSet(){for(const R in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(R)&&this.voiceGeneratorsDict[R].checkOpenTies()}getOrCreateVoiceGenerator(R,F){const D=this.instrument.Staves[F];let G=this.voiceGeneratorsDict[R];if(G)D.Voices.indexOf(G.GetVoice)===-1&&D.Voices.push(G.GetVoice);else{const U=this.staffMainVoiceGeneratorDict[F];U?(G=new VoiceGenerator(this.pluginManager,D,R,this.slurReader,U.GetVoice),D.Voices.push(G.GetVoice),this.voiceGeneratorsDict[R]=G):(G=new VoiceGenerator(this.pluginManager,D,R,this.slurReader),D.Voices.push(G.GetVoice),this.voiceGeneratorsDict[R]=G,this.staffMainVoiceGeneratorDict[F]=G)}return G}createExpressionGenerators(R){this.expressionReaders=new Array(R);for(let F=0;F0?F=this.musicSheet.SourceMeasures[0]:F=this.currentMeasure;const D=new ClefInstruction(ClefEnum.G,0,2);let G;F.FirstInstructionsStaffEntries[R]?(G=F.FirstInstructionsStaffEntries[R],G.removeFirstInstructionOfTypeClefInstruction()):(G=new SourceStaffEntry(void 0,void 0),F.FirstInstructionsStaffEntries[R]=G),D.Parent=G,G.Instructions.splice(0,0,D)}createDefaultKeyInstruction(){let R;this.musicSheet.SourceMeasures.length>0?R=this.musicSheet.SourceMeasures[0]:R=this.currentMeasure;const F=new KeyInstruction(void 0,0,KeyEnum.major);for(let D=this.inSourceMeasureInstrumentIndex;D0&&D[G-1].name==="backup")return!0;let U=-1;for(let W=0;W0||U<0}isAttributesNodeAtEndOfMeasure(R,F){const D=R.elements().slice();let G=0;for(let W=0;WU}getNoteDurationFromTypeNode(R){const F=R.element("type");if(F){const D=F.value;return NoteTypeHandler.getNoteDurationFromType(D)}return new Fraction$1(0,4*this.divisions)}addAbstractInstruction(R,F,D,G){if(R.element("divisions")&&R.elements().length===1)return;const U=R.element("transpose");if(U){const Y=U.element("chromatic");Y&&(this.instrument.PlaybackTranspose=parseInt(Y.value,10))}const W=R.elements("clef");let q;if(W.length>0)for(let Y=0,K=W.length;Y using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(q),Q=2,log$2.debug("InstrumentReader.addAbstractInstruction",q,le)}const ie=Z.element("sign");if(ie)try{j=ClefEnum[ie.value],ClefInstruction.isSupportedClef(j)||(q=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(q),j=ClefEnum.G,Q=2),j===ClefEnum.TAB&&(te=-1)}catch(le){q=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(q),j=ClefEnum.G,Q=2,log$2.debug("InstrumentReader.addAbstractInstruction",q,le)}const re=Z.element("clef-octave-change");if(re)try{te=parseInt(re.value,10)}catch{q=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(q),te=0}if(Z.hasAttributes&&Z.attribute("number"))try{J=parseInt(Z.attribute("number").value,10),J>this.currentClefNumber&&(J=this.currentClefNumber),this.currentClefNumber=J+1}catch{q=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(q),J=1,this.currentClefNumber=J+1}const oe=new ClefInstruction(j,te,Q);this.abstractInstructions.push([J,oe,G])}if(R.element("key")!==void 0&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){let Y=0;const K=R.element("key").element("fifths");if(K)try{Y=parseInt(K.value,10)}catch(J){q=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(q),Y=0,log$2.debug("InstrumentReader.addAbstractInstruction",q,J)}let Z=KeyEnum.none,j=R.element("key");if(j&&(j=j.element("mode")),j)try{Z=KeyEnum[j.value]}catch(J){q=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(q),Z=KeyEnum.major,log$2.debug("InstrumentReader.addAbstractInstruction",q,J)}const Q=new KeyInstruction(void 0,Y,Z);this.abstractInstructions.push([1,Q,G])}if(R.element("time")){const Y=R.element("time");let K=RhythmSymbolEnum.NONE,Z=!0;if(Y!==void 0&&Y.hasAttributes){const re=Y.attribute("symbol");re&&(re.value==="common"?K=RhythmSymbolEnum.COMMON:re.value==="cut"&&(K=RhythmSymbolEnum.CUT));const oe=Y.attribute("print-object");oe&&oe.value==="no"&&(Z=!1)}let j=0,Q=0;const J=Y&&Y.element("senza-misura")!==void 0,te=R.elements("time"),ne=[],ie=[];for(let re=0,oe=te.length;re0&&ie!==void 0&&ne.length===ie.length){const oe=ne.length,le=new Array(oe);let fe=0;for(let he=0;he set to default."),this.musicSheet.SheetErrors.pushMeasureError(q),j=4,Q=4,log$2.debug("InstrumentReader.addAbstractInstruction",q,oe)}const re=new RhythmInstruction(new Fraction$1(j,Q,0,!1),K);re.PrintObject=Z,this.abstractInstructions.push([1,re,G])}}}saveAbstractInstructionList(R,F){for(let D=this.abstractInstructions.length-1;D>=0;D--){const G=this.abstractInstructions[D],U=G[0],W=G[1],q=G[2];if(W instanceof ClefInstruction){const Y=W;if(this.currentXmlMeasureIndex===0||U<=this.activeClefs.length&&Y!==this.activeClefs[U-1])if(!F&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&U-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const K=Y,Z=this.currentStaffEntry;if(q&&Math.abs(q.RealValue-Z.Timestamp.RealValue)>.01)continue;K.Parent=Z,Z.removeFirstInstructionOfTypeClefInstruction(),Z.Instructions.push(K),this.activeClefs[U-1]=Y,this.abstractInstructions.splice(D,1)}else if(F){if(q.RealValue!==0)continue;let K;if(this.currentMeasure){const Z=Y,j=this.inSourceMeasureInstrumentIndex+U-1,Q=this.currentMeasure.FirstInstructionsStaffEntries[j];if(this.currentXmlMeasureIndex===0)if(!Q)K=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[j]=K,Z.Parent=K,K.Instructions.push(Z),this.activeClefsHaveBeenInitialized[U-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[j]!==void 0&&!(Q.Instructions[0]instanceof ClefInstruction))K=Q,Z.Parent=K,K.removeFirstInstructionOfTypeClefInstruction(),K.Instructions.splice(0,0,Z),this.activeClefsHaveBeenInitialized[U-1]=!0;else{const J=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[j]=J,Z.Parent=J,J.Instructions.push(Z)}else if(this.activeClefsHaveBeenInitialized[U-1]){let J=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(J=this.currentMultirestStartMeasure);const te=new SourceStaffEntry(void 0,void 0);J.LastInstructionsStaffEntries[j]=te,Z.Parent=te,te.Instructions.push(Z)}else{const J=this.musicSheet.SourceMeasures[0];J.FirstInstructionsStaffEntries[j]?(K=J.FirstInstructionsStaffEntries[j],K.removeFirstInstructionOfTypeClefInstruction()):K=new SourceStaffEntry(void 0,void 0),Z.Parent=K,K.Instructions.splice(0,0,Z),this.activeClefsHaveBeenInitialized[U-1]=!0}this.activeClefs[U-1]=Y,this.abstractInstructions.splice(D,1)}}else{let K;const Z=this.activeRhythm.Rhythm;Z.RealValue>0&&q.RealValue/Z.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[U-1]||(this.currentMeasure.LastInstructionsStaffEntries[U-1]=new SourceStaffEntry(void 0,this.instrument.Staves[U-1])),K=this.currentMeasure.LastInstructionsStaffEntries[U-1]),K&&(Y.Parent=K,K.Instructions.push(Y),this.activeClefs[U-1]=Y,this.abstractInstructions.splice(D,1))}else U<=this.activeClefs.length&&Y===this.activeClefs[U-1]&&this.abstractInstructions.splice(D,1)}if(W instanceof KeyInstruction){const Y=W;if(!this.activeKey||this.activeKey.Key!==Y.Key){this.activeKey=Y,this.abstractInstructions.splice(D,1);let K;if(this.activeKeyHasBeenInitialized?K=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?K=this.musicSheet.SourceMeasures[0]:K=this.currentMeasure),K)for(let Z=this.inSourceMeasureInstrumentIndex;Z=0;R--){const F=this.abstractInstructions[R][0],D=this.abstractInstructions[R][1];if(D instanceof ClefInstruction){const G=D;if(!this.activeClefs[F-1]||G.ClefType!==this.activeClefs[F-1].ClefType||G.ClefType===this.activeClefs[F-1].ClefType&&G.Line!==this.activeClefs[F-1].Line){const U=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+F-1]=U;const W=G;W.Parent=U,U.Instructions.push(W),this.activeClefs[F-1]=G,this.abstractInstructions.splice(R,1)}}}}getNoteDurationForTuplet(R){let F=new Fraction$1(0,1);const D=this.getNoteDurationFromTypeNode(R);if(R.element("time-modification")){const G=R.element("time-modification");if(G&&G.element("actual-notes")!==void 0&&G.element("normal-notes")){const U=G.element("actual-notes"),W=G.element("normal-notes");if(U!==void 0&&W){const q=parseInt(U.value,10),Y=parseInt(W.value,10);F=new Fraction$1(Y*D.Numerator,q*D.Denominator)}}}return F}readExpressionStaffNumber(R){let F=1;if(R.element("staff")){const D=R.element("staff");if(D)try{F=parseInt(D.value,10)}catch(G){const U=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(U),F=1,log$2.debug("InstrumentReader.readExpressionStaffNumber",U,G)}}return F}readDivisionsFromNotes(){let R=0,F=this.currentXmlMeasureIndex,D=!1;for(;!D;){const G=this.xmlMeasureList[F].elements();for(let U=0,W=G.length;U0){D=!0;break}}if(R===0&&(F++,F===this.xmlMeasureList.length)){const U=ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new MusicSheetReadingException(U+this.instrument.Name)}}return R}}const _SubInstrument=class{constructor(B){this.parentInstrument=B,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=_SubInstrument.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(B){return B===MidiInstrument.Acoustic_Grand_Piano||B===MidiInstrument.Bright_Acoustic_Piano||B===MidiInstrument.Electric_Grand_Piano||B===MidiInstrument.Electric_Piano_1||B===MidiInstrument.Electric_Piano_2}setMidiInstrument(B){this.midiInstrumentID=_SubInstrument.midiInstrument[this.parseMidiInstrument(B)]}parseMidiInstrument(B){try{if(B){let R=B.toLowerCase().trim();R=R.replace(/\s+/g,"_");for(const F in _SubInstrument.midiInstrument)if(R.indexOf(F)!==-1)return F}if(this.parentInstrument.Name){let R=this.parentInstrument.Name.toLowerCase().trim();R=R.replace(/\s+/g,"_");for(const F in _SubInstrument.midiInstrument)if(R.indexOf(F)!==-1)return F}}catch{log$2.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};let SubInstrument=_SubInstrument;SubInstrument.midiInstrument={alto_saxophone:MidiInstrument.Alto_Sax,baritone_saxophone:MidiInstrument.Baritone_Sax,horn_in_f:MidiInstrument.French_Horn,english_horn:MidiInstrument.English_Horn,euphonium:MidiInstrument.Euphonium,clarinet_in_bb:MidiInstrument.clarinet_in_bb,clarinet_in_eb:MidiInstrument.clarinet_in_eb,clarinet:MidiInstrument.Clarinet,alto_clarinet:MidiInstrument.Alto_Clarinet,bass_clarinet:MidiInstrument.Bass_Clarinet,bassoon:MidiInstrument.Bassoon,bass_trombone:MidiInstrument.Bass_Trombone,alt:MidiInstrument.Synth_Voice,alto:MidiInstrument.Synth_Voice,banjo:MidiInstrument.Banjo,bariton:MidiInstrument.Synth_Voice,baritone:MidiInstrument.Synth_Voice,bass:MidiInstrument.Synth_Voice,blockfl\u00F6te:MidiInstrument.Recorder,brass:MidiInstrument.Trombone,bratsche:MidiInstrument.Viola,cello:MidiInstrument.Cello,contrabass:MidiInstrument.Contrabass,drums:MidiInstrument.Percussion,flute:MidiInstrument.Flute,fl\u00F6te:MidiInstrument.Flute,frenchhorn:MidiInstrument.French_Horn,gitarre:MidiInstrument.Acoustic_Guitar_nylon,guitar:MidiInstrument.Acoustic_Guitar_nylon,harfe:MidiInstrument.Orchestral_Harp,harp:MidiInstrument.Orchestral_Harp,klarinette:MidiInstrument.Clarinet,klavier:MidiInstrument.Acoustic_Grand_Piano,kontrabass:MidiInstrument.Contrabass,oboe:MidiInstrument.Oboe,organ:MidiInstrument.Church_Organ,orgel:MidiInstrument.Church_Organ,orgue:MidiInstrument.Church_Organ,percussion:MidiInstrument.Synth_Drum,\u5C0F\u519B\u9F13:MidiInstrument.Synth_Drum,snare_drum:MidiInstrument.Synth_Drum,bass_drum:MidiInstrument.Synth_Drum,side_drum:MidiInstrument.Synth_Drum,piano:MidiInstrument.Acoustic_Grand_Piano,piccolo:MidiInstrument.Piccolo,posaune:MidiInstrument.Trombone,recorder:MidiInstrument.Recorder,sax:MidiInstrument.Tenor_Sax,schlagwerk:MidiInstrument.Percussion,schlagzeug:MidiInstrument.Percussion,sopran:MidiInstrument.Synth_Voice,steeldrum:MidiInstrument.Steel_Drums,streicher:MidiInstrument.String_Ensemble_1,strings:MidiInstrument.String_Ensemble_1,tenor:MidiInstrument.Synth_Voice,tpt:MidiInstrument.Trumpet,trombone:MidiInstrument.Trombone,trompete:MidiInstrument.Trumpet,trumpet:MidiInstrument.Trumpet,tuba:MidiInstrument.Tuba,unnamed:MidiInstrument.Acoustic_Grand_Piano,viola:MidiInstrument.Viola,violin:MidiInstrument.Violin,"violon-c":MidiInstrument.Cello,"violon.":MidiInstrument.Violin,voice:MidiInstrument.Synth_Voice,woodblock:MidiInstrument.Woodblock,alto_clarinet_in_eb:MidiInstrument.AltoClarinetInEb,trumpet_in_bb:MidiInstrument.TrumpetInBb,tenor_saxophone:MidiInstrument.TenorSaxophone};class StringUtil{static StringContainsSeparatedWord(R,F,D=!1){return new RegExp("( |^)"+F+"([ .]|$)",D?"i":void 0).test(R)}}class RepetitionInstructionReader{set MusicSheet(R){this.musicSheet=R,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(R,F){this.currentMeasureIndex=F}handleLineRepetitionInstructions(R){let F=!1;if(R.elements().length>0){let D="",G=!1,U="",W="",q="";const Y=[],K=R.element("bar-style");K&&(q=K.value),R.attributes().length>0&&R.attribute("location")?D=R.attribute("location").value:D="right";const Z=R.elements();for(let j=0,Q=Z.length;j0)if(D==="left"){if(W==="start"){const j=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,Y);this.addInstruction(this.repetitionInstructions,j)}if(U==="forward"){const j=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,j)}}else{if(W==="stop"){const j=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,Y);this.addInstruction(this.repetitionInstructions,j)}if(U==="backward"){const j=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,j)}}}return F}handleRepetitionInstructionsFromWordsOrSymbols(R,F){const D=R.element("words"),G=this.currentMeasureIndex;if(D){const U="d\\s?\\.s\\.",W=D.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(W,U+" al fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,U+" al coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}const q="d\\.\\s?c\\.";if(StringUtil.StringContainsSeparatedWord(W,q+" al fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,q+" al coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,q)||StringUtil.StringContainsSeparatedWord(W,"da\\s?capo",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,U,!0)||StringUtil.StringContainsSeparatedWord(W,"dal\\s?segno",!0)){let Y;return StringUtil.StringContainsSeparatedWord(W,"al\\s?coda",!0)?Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegnoAlCoda):Y=new RepetitionInstruction(G,RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(W,"a (la )?coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,"fine",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,"coda",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,Y),!0}if(StringUtil.StringContainsSeparatedWord(W,"segno",!0)){const Y=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,Y),!0}}else if(R.element("segno")){const U=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,U),!0}else if(R.element("coda")){const U=new RepetitionInstruction(G,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,U),!0}return!1}removeRedundantInstructions(){let R=0,F=0,D=0,G=0;for(let U=0;U0&&this.findInstructionInPreviousMeasure(U,W.measureIndex,RepetitionInstructionEnum.ToCoda)&&(W.type=RepetitionInstructionEnum.None),F===0&&D===0&&(W.type=RepetitionInstructionEnum.ToCoda,W.alignment=AlignmentType.End,W.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(R-G>0){let q=!1;for(let Y=0,K=this.repetitionInstructions.length;Y0?Z.type=RepetitionInstructionEnum.DalSegnoAlCoda:Z.type=RepetitionInstructionEnum.DalSegno,W.type=RepetitionInstructionEnum.None,q=!0;break;case RepetitionInstructionEnum.DalSegno:case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:W.type=RepetitionInstructionEnum.None,q=!0;break}if(q)break}if(q)break;D-F>0?W.type=RepetitionInstructionEnum.DalSegnoAlCoda:W.type=RepetitionInstructionEnum.DalSegno,W.alignment=AlignmentType.End,W.measureIndex--}break}if(this.backwardSearchForPreviousIdenticalInstruction(U,W)||W.type===RepetitionInstructionEnum.None)this.repetitionInstructions.splice(U,1),U--;else switch(W.type){case RepetitionInstructionEnum.Fine:break;case RepetitionInstructionEnum.ToCoda:D++;break;case RepetitionInstructionEnum.Coda:F++;break;case RepetitionInstructionEnum.Segno:R++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:G++;break}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(R,F,D){for(let G=R-1;G>=0;G--){const U=this.repetitionInstructions[G];if(F-U.measureIndex===1&&U.type===D)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(R,F){for(let D=R-1;D>=0;D--)if(this.repetitionInstructions[D].equals(F))return!0;return!1}addInstruction(R,F){let D=!0;for(let G=0,U=R.length;G0;)try{const q=this.openRepetitions.last();if(q.RepetitonUnderConstruction.FromWords){if(q.WaitingForCoda){let Y=q.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;Y>=this.musicSheet.SourceMeasures.length&&(Y=-1),q.RepetitonUnderConstruction.setEndingStartIndex(2,Y)}else if(q.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(q.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const Y=D.length-1,K=new RepetitionInstruction(Y,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,q.RepetitonUnderConstruction);q.RepetitonUnderConstruction.BackwardJumpInstructions.push(K),D[Y].LastRepetitionInstructions.push(K)}this.finalizeRepetition(this.openRepetitions.last())}catch{try{const Y=this.openRepetitions.last().RepetitonUnderConstruction;for(const K of this.repetitionInstructions)K.parentRepetition===Y&&(K.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(Y){log$2.error("RepetitionCalculator: calculateRepetitions2",Y)}}let G=!1;const U=0,W=this.musicSheet.SourceMeasures.length-1;for(const q of this.musicSheet.Repetitions)if(q.StartIndex===U&&q.EndIndex===W){G=!0;break}if(!G){const q=new Repetition(this.musicSheet,!0);q.FromWords=!0,q.startMarker=new RepetitionInstruction(U,RepetitionInstructionEnum.StartLine),q.startMarker.parentRepetition=q,this.musicSheet.SourceMeasures[U].FirstRepetitionInstructions.push(q.startMarker),q.endMarker=new RepetitionInstruction(W,RepetitionInstructionEnum.BackJumpLine),q.endMarker.parentRepetition=q,q.BackwardJumpInstructions.push(q.endMarker),q.UserNumberOfRepetitions=q.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(q)}for(let q=0,Y=this.musicSheet.SourceMeasures.length;q1&&K.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),K.LastRepetitionInstructions.length>1&&K.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(R){let F;switch(R.type){case RepetitionInstructionEnum.StartLine:F=this.createNewRepetition(this.currentMeasureIndex),R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.FromWords=!1,F.RepetitonUnderConstruction.startMarker=R,this.currentMeasure.FirstRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.BackJumpLine:F=this.getOrCreateCurrentRepetition2(!1),R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R),F.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(F);break;case RepetitionInstructionEnum.Ending:if(F=this.getOrCreateCurrentRepetition(),R.parentRepetition=F.RepetitonUnderConstruction,R.endingIndices.contains(1)&&R.alignment===AlignmentType.Begin){if(F.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){F=void 0;for(let G=this.openRepetitions.length-1;G>=0;G--){const U=this.openRepetitions[G];if(U.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(F=U;this.openRepetitions.length-1>G;){const W=this.openRepetitions.last();this.finalizeRepetition(W)}}F===void 0&&(F=this.createNewRepetition(0),F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}F.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(F.RepetitonUnderConstruction.forwardJumpInstruction))}if(R.alignment===AlignmentType.Begin)F.RepetitonUnderConstruction.setEndingsStartIndex(R.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(R);else for(let G=0,U=R.endingIndices.length;G0&&Math.abs(F.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(G=>G.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;F=this.createNewRepetition(this.currentMeasureIndex),R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.FromWords=!0,F.SegnoFound=!0,F.RepetitonUnderConstruction.startMarker=R,this.currentMeasure.FirstRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(F=this.getCurrentRepetition(!0),F===void 0))break;R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.FromWords=!0,F.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(F.FineFound=!0,F.RepetitonUnderConstruction.forwardJumpInstruction=R,F.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(R)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Fine,AlignmentType.End,void 0));break;case RepetitionInstructionEnum.ToCoda:if(this.openRepetitions.length===0||(F=this.getCurrentRepetition(!0),F===void 0))break;F.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.FromWords=!0,F.ToCodaFound=!0,F.RepetitonUnderConstruction.forwardJumpInstruction=R,this.currentMeasure.LastRepetitionInstructions.push(R));break;case RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;F=this.getOrCreateCurrentRepetition2(!0),R.parentRepetition=F.RepetitonUnderConstruction,F.WaitingForCoda?(F.CodaFound=!0,F.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(R),this.finalizeRepetition(F),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):F.ToCodaFound||(F.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(F.ToCodaFound=!0,F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,F.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(F.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:F=this.getOrCreateCurrentRepetition(),F.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(F),F.RepetitonUnderConstruction.StartIndex!==0&&(F=this.createNewRepetition(0)),R.parentRepetition=F.RepetitonUnderConstruction,F.RepetitonUnderConstruction.FromWords=!0,F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,F.RepetitonUnderConstruction),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R),F.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(F);break;case RepetitionInstructionEnum.DalSegno:if(F=this.getOrCreateCurrentRepetition2(!0),F.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(F),F=this.createNewRepetition(0),F.RepetitonUnderConstruction.FromWords=!0,F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,F.RepetitonUnderConstruction)),R.parentRepetition=F.RepetitonUnderConstruction,!F.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,R.measureIndex);G>=0&&(F.SegnoFound=!0,F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.startMarker))}F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&F.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(F=this.getOrCreateCurrentRepetition2(!0),R.parentRepetition=F.RepetitonUnderConstruction,!F.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,R.measureIndex);G>=0&&(F.SegnoFound=!0,F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.startMarker))}if(!F.FineFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,R.measureIndex);G>=0&&(F.FineFound=!0,F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine,AlignmentType.Begin,F.RepetitonUnderConstruction),F.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction))}F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||F.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.DaCapoAlFine:if(F=this.getOrCreateCurrentRepetition(),F.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(F),F=this.createNewRepetition(0)),F.RepetitonUnderConstruction.startMarker!==void 0&&F.RepetitonUnderConstruction.StartIndex!==0&&(F=this.createNewRepetition(0)),F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,F.RepetitonUnderConstruction),F.RepetitonUnderConstruction.FromWords=!0,R.parentRepetition=F.RepetitonUnderConstruction,!F.FineFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,R.measureIndex);G>=0&&(F.FineFound=!0,F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.Fine,AlignmentType.Begin,F.RepetitonUnderConstruction),F.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction))}F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||F.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(F=this.getOrCreateCurrentRepetition2(!0),R.parentRepetition=F.RepetitonUnderConstruction,!F.SegnoFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,R.measureIndex);G>=0&&(F.SegnoFound=!0,F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(G,RepetitionInstructionEnum.Segno,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].FirstRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.startMarker))}if(!F.ToCodaFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,R.measureIndex);if(G>=0)F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction),F.ToCodaFound=!0;else{const U=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,R.measureIndex);U>=0&&(F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(U,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[U].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction),F.ToCodaFound=!0)}}F.ToCodaFound&&(F.WaitingForCoda=!0),F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||F.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(F=this.getOrCreateCurrentRepetition(),F.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(F),F=this.createNewRepetition(0)):F.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(F),F=this.createNewRepetition(0)),F.RepetitonUnderConstruction.startMarker!==void 0&&F.RepetitonUnderConstruction.StartIndex!==0&&(F=this.createNewRepetition(0)),F.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,F.RepetitonUnderConstruction),F.RepetitonUnderConstruction.FromWords=!0,R.parentRepetition=F.RepetitonUnderConstruction,!F.ToCodaFound){const G=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,R.measureIndex);if(G>=0)F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(G,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[G].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction),F.ToCodaFound=!0;else{const U=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,R.measureIndex);U>=0&&(F.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(U,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,F.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[U].LastRepetitionInstructions.splice(0,0,F.RepetitonUnderConstruction.forwardJumpInstruction),F.ToCodaFound=!0)}}F.ToCodaFound&&(F.WaitingForCoda=!0),F.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||F.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),F.RepetitonUnderConstruction.BackwardJumpInstructions.push(R),this.currentMeasure.LastRepetitionInstructions.push(R);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(R,F){for(let D=this.repetitionInstructions.length-1;D>=0;D--){const G=this.repetitionInstructions[D];if(G.measureIndex<=F&&G.type===R)return G.measureIndex}return-1}finalizeRepetition(R){const F=R.RepetitonUnderConstruction;if(F.BackwardJumpInstructions.length>0){let D=!0;const G=this.getLastFinalizedRepetition();if(G!==void 0&&F.coversIdenticalMeasures(G)){if(F.NumberOfEndings>G.NumberOfEndings){const U=this.musicSheet.Repetitions.indexOf(G,0);U>-1&&this.musicSheet.Repetitions.splice(U,1),G.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(F)}D=!1,F.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(F);D&&(F.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[F.StartIndex].FirstRepetitionInstructions.push(F.startMarker),F.UserNumberOfRepetitions=F.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(R){let F;for(let D=this.openRepetitions.length-1;D>=0;D--)if(this.openRepetitions[D].RepetitonUnderConstruction.FromWords===R){for(F=this.openRepetitions[D];D0)return this.openRepetitions.last();const R=this.createNewRepetition(0);return R.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,R.RepetitonUnderConstruction),R}getOrCreateCurrentRepetition2(R){let F;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let G=this.openRepetitions.length-1;G>=0;G--)if(F=this.openRepetitions[G],F.RepetitonUnderConstruction.FromWords===R){for(;G0){const D=this.openRepetitions.last(),G=D.RepetitonUnderConstruction;if(G.BackwardJumpInstructions.length>0){const U=Object.keys(G.EndingIndexDict);(U.length===0||G.EndingIndexDict[U[U.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(D)}}const F=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=R,this.openRepetitions.push(F),F}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}class RepetitionBuildingContainer{constructor(R){this.RepetitonUnderConstruction=new Repetition(R)}}class MusicSymbolModuleFactory{static createRepetitionInstructionReader(){return new RepetitionInstructionReader}static createRepetitionCalculator(){return new RepetitionCalculator}}class ReaderPluginManager{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(R){this.voiceMeasureReadPlugins.push(R)}processVoiceMeasureReadPlugins(R,F,D){for(const G of this.voiceMeasureReadPlugins)try{G.measureReadCalculations(R,F,D)}catch(U){log$2.info("VoiceGenerator.addSingleNote: ",U)}}}class MusicSheetReader{constructor(R=void 0,F=new EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new ReaderPluginManager,R?this.afterSheetReadingModules=R:this.afterSheetReadingModules=[],this.repetitionInstructionReader=MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=F}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(R){for(const F of R)F.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(R,F){try{return this._createMusicSheet(R,F)}catch(D){log$2.error("MusicSheetReader.CreateMusicSheet",D);return}}_removeFromArray(R,F){const D=R.indexOf(F);D!==-1&&R.splice(D,1)}trimString(R){return R.replace(/^\s+|\s+$/g,"")}_lastElement(R){return R[R.length-1]}_createMusicSheet(R,F){var j;const D=[];let G=0;if(this.musicSheet=new MusicSheet$1,this.musicSheet.Path=F,this.musicSheet.Rules=this.rules,!R)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(R,F);const U=R.element("part-list");if(!U)throw new MusicSheetReadingException("Undefined partListNode");const W=R.elements("part"),q=U.elements();this.initializeReading(q,W,D);let Y=!0;this.currentFraction=new Fraction$1(0,1);let K=!1,Z=R.element("identification");for(Z&&(Z=Z.element("encoding")),Z&&(Z=Z.element("software")),Z!==void 0&&Z.value==="Guitar Pro 5"&&(K=!0);Y;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(G=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const Q of D)try{Y=Y&&Q.readNextXmlMeasure(this.currentMeasure,this.currentFraction,K)}catch(J){const te=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(te,J)}Y&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(D),this.checkSourceMeasureForNullEntries(),G=this.setSourceMeasureDuration(D,G),MusicSheetReader.doCalculationsAfterDurationHasBeenSet(D),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure,this.musicSheet.SoundTempos=(j=D[0])==null?void 0:j.SoundTempos)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=100),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let Q=0,J=this.afterSheetReadingModules.length;QD){if(this.areRhythmInstructionsMixed(F)&&q.SymbolEnum!==RhythmSymbolEnum.NONE)continue;D=q.Rhythm.RealValue,G=F.indexOf(q)}}if(F.length>0&&F.lengthR.Denominator){const D=F.Denominator/R.Denominator;R.expand(D)}}checkIfMeasureIsImplicit(R,F){return!this.previousMeasure&&R.lt(F)?!0:this.previousMeasure?Fraction$1.plus(this.previousMeasure.Duration,R).Equals(F):!1}allInstrumentsHaveSameDuration(R,F){let D=0;for(let G=0,U=R.length;G=0;R--)for(let F=this.currentMeasure.VerticalSourceStaffEntryContainers[R].StaffEntries.length-1;F>=0;F--){const D=this.currentMeasure.VerticalSourceStaffEntryContainers[R].StaffEntries[F];if(D)for(let G=D.VoiceEntries.length-1;G>=0;G--){const U=D.VoiceEntries[G];U.Notes.length===0&&(this._removeFromArray(U.ParentVoice.VoiceEntries,U),this._removeFromArray(D.VoiceEntries,U))}D!==void 0&&D.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[R].StaffEntries[F]=void 0)}for(let R=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;R>=0;R--){let F=0;for(let D=0,G=this.currentMeasure.VerticalSourceStaffEntryContainers[R].StaffEntries.length;DF){if(!this.musicSheet.Title){const le=te.attribute("font-size").value,fe=parseFloat(le);D0&&Z.MidiInstrumentId!==MidiInstrument.Percussion&&(ne.midiInstrumentID=Math.max(0,parseInt(le.value,10)-1));else if(le.name==="midi-unpitched")ne.fixedKey=Math.max(0,parseInt(le.value,10));else if(le.name==="volume")try{const fe=parseFloat(le.value);ne.volume=fe/127}catch(fe){log$2.debug("ExpressionReader.readExpressionParameters","read volume",fe)}else if(le.name==="pan")try{const fe=parseFloat(le.value);ne.pan=fe/64}catch(fe){log$2.debug("ExpressionReader.readExpressionParameters","read pan",fe)}}catch(fe){log$2.info("MusicSheetReader.createInstrumentGroups midi settings: ",fe)}}}}catch(ne){log$2.info("MusicSheetReader.createInstrumentGroups: ",ne)}}if(Z.SubInstruments.length===0){const Q=new SubInstrument(Z);Z.SubInstruments.push(Q)}D[K]=Z,G?(G.InstrumentalGroups.push(Z),this.musicSheet.Instruments.push(Z)):(this.musicSheet.InstrumentalGroups.push(Z),this.musicSheet.Instruments.push(Z))}else if(Y.name==="part-group"&&Y.attribute("type").value==="start"){const K=new InstrumentalGroup("group",this.musicSheet,G);G?G.InstrumentalGroups.push(K):this.musicSheet.InstrumentalGroups.push(K),G=K}else if(Y.name==="part-group"&&Y.attribute("type").value==="stop"&&G){if(G.InstrumentalGroups.length===1){const K=G.InstrumentalGroups[0];G.Parent?(G.Parent.InstrumentalGroups.push(K),this._removeFromArray(G.Parent.InstrumentalGroups,G)):(this.musicSheet.InstrumentalGroups.push(K),this._removeFromArray(this.musicSheet.InstrumentalGroups,G))}G=G.Parent}}}catch(U){const W=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new MusicSheetReadingException(W,U)}for(let U=0,W=this.musicSheet.Instruments.length;U0){const U=G[0];if(U){let W=U.element("attributes");W&&(W=W.element("staves")),W?F+=parseInt(W.value,10):F++}}}if(isNaN(F)||F<=0){const D=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(D)}return F}getInstrumentNumberOfStavesFromXml(R){let F=0;const D=R.element("measure");if(D){const G=D.element("attributes");let U;G&&(U=G.element("staves")),!G||!U?F=1:F=parseInt(U.value,10)}if(isNaN(F)||F<=0){const G=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(G)}return F}}var jszip_min={exports:{}};/*! JSZip v3.7.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */(function(B,R){(function(F){B.exports=F()})(function(){return function F(D,G,U){function W(K,Z){if(!G[K]){if(!D[K]){var j=typeof commonjsRequire$1=="function"&&commonjsRequire$1;if(!Z&&j)return j(K,!0);if(q)return q(K,!0);var Q=new Error("Cannot find module '"+K+"'");throw Q.code="MODULE_NOT_FOUND",Q}var J=G[K]={exports:{}};D[K][0].call(J.exports,function(te){var ne=D[K][1][te];return W(ne||te)},J,J.exports,F,D,G,U)}return G[K].exports}for(var q=typeof commonjsRequire$1=="function"&&commonjsRequire$1,Y=0;Y>2,J=(3&K)<<4|Z>>4,te=1>6:64,ne=2>4,Z=(15&Q)<<4|(J=q.indexOf(Y.charAt(ne++)))>>2,j=(3&J)<<6|(te=q.indexOf(Y.charAt(ne++))),oe[ie++]=K,J!==64&&(oe[ie++]=Z),te!==64&&(oe[ie++]=j);return oe}},{"./support":30,"./utils":32}],2:[function(F,D,G){var U=F("./external"),W=F("./stream/DataWorker"),q=F("./stream/Crc32Probe"),Y=F("./stream/DataLengthProbe");function K(Z,j,Q,J,te){this.compressedSize=Z,this.uncompressedSize=j,this.crc32=Q,this.compression=J,this.compressedContent=te}K.prototype={getContentWorker:function(){var Z=new W(U.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Y("data_length")),j=this;return Z.on("end",function(){if(this.streamInfo.data_length!==j.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),Z},getCompressedWorker:function(){return new W(U.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},K.createWorkerFrom=function(Z,j,Q){return Z.pipe(new q).pipe(new Y("uncompressedSize")).pipe(j.compressWorker(Q)).pipe(new Y("compressedSize")).withStreamInfo("compression",j)},D.exports=K},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(F,D,G){var U=F("./stream/GenericWorker");G.STORE={magic:"\0\0",compressWorker:function(W){return new U("STORE compression")},uncompressWorker:function(){return new U("STORE decompression")}},G.DEFLATE=F("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(F,D,G){var U=F("./utils"),W=function(){for(var q,Y=[],K=0;K<256;K++){q=K;for(var Z=0;Z<8;Z++)q=1&q?3988292384^q>>>1:q>>>1;Y[K]=q}return Y}();D.exports=function(q,Y){return q!==void 0&&q.length?U.getTypeOf(q)!=="string"?function(K,Z,j,Q){var J=W,te=Q+j;K^=-1;for(var ne=Q;ne>>8^J[255&(K^Z[ne])];return-1^K}(0|Y,q,q.length,0):function(K,Z,j,Q){var J=W,te=Q+j;K^=-1;for(var ne=Q;ne>>8^J[255&(K^Z.charCodeAt(ne))];return-1^K}(0|Y,q,q.length,0):0}},{"./utils":32}],5:[function(F,D,G){G.base64=!1,G.binary=!1,G.dir=!1,G.createFolders=!0,G.date=null,G.compression=null,G.compressionOptions=null,G.comment=null,G.unixPermissions=null,G.dosPermissions=null},{}],6:[function(F,D,G){var U=null;U=typeof Promise!="undefined"?Promise:F("lie"),D.exports={Promise:U}},{lie:37}],7:[function(F,D,G){var U=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",W=F("pako"),q=F("./utils"),Y=F("./stream/GenericWorker"),K=U?"uint8array":"array";function Z(j,Q){Y.call(this,"FlateWorker/"+j),this._pako=null,this._pakoAction=j,this._pakoOptions=Q,this.meta={}}G.magic="\b\0",q.inherits(Z,Y),Z.prototype.processChunk=function(j){this.meta=j.meta,this._pako===null&&this._createPako(),this._pako.push(q.transformTo(K,j.data),!1)},Z.prototype.flush=function(){Y.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},Z.prototype.cleanUp=function(){Y.prototype.cleanUp.call(this),this._pako=null},Z.prototype._createPako=function(){this._pako=new W[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var j=this;this._pako.onData=function(Q){j.push({data:Q,meta:j.meta})}},G.compressWorker=function(j){return new Z("Deflate",j)},G.uncompressWorker=function(){return new Z("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(F,D,G){function U(J,te){var ne,ie="";for(ne=0;ne>>=8;return ie}function W(J,te,ne,ie,re,oe){var le,fe,he=J.file,ge=J.compression,ce=oe!==K.utf8encode,me=q.transformTo("string",oe(he.name)),ye=q.transformTo("string",K.utf8encode(he.name)),ve=he.comment,pe=q.transformTo("string",oe(ve)),be=q.transformTo("string",K.utf8encode(ve)),xe=ye.length!==he.name.length,ue=be.length!==ve.length,_e="",Be="",Ae="",Pe=he.dir,Ie=he.date,Ce={crc32:0,compressedSize:0,uncompressedSize:0};te&&!ne||(Ce.crc32=J.crc32,Ce.compressedSize=J.compressedSize,Ce.uncompressedSize=J.uncompressedSize);var Te=0;te&&(Te|=8),ce||!xe&&!ue||(Te|=2048);var Se=0,Ne=0;Pe&&(Se|=16),re==="UNIX"?(Ne=798,Se|=function(ke,$e){var We=ke;return ke||(We=$e?16893:33204),(65535&We)<<16}(he.unixPermissions,Pe)):(Ne=20,Se|=function(ke){return 63&(ke||0)}(he.dosPermissions)),le=Ie.getUTCHours(),le<<=6,le|=Ie.getUTCMinutes(),le<<=5,le|=Ie.getUTCSeconds()/2,fe=Ie.getUTCFullYear()-1980,fe<<=4,fe|=Ie.getUTCMonth()+1,fe<<=5,fe|=Ie.getUTCDate(),xe&&(Be=U(1,1)+U(Z(me),4)+ye,_e+="up"+U(Be.length,2)+Be),ue&&(Ae=U(1,1)+U(Z(pe),4)+be,_e+="uc"+U(Ae.length,2)+Ae);var Ge="";return Ge+=` \0`,Ge+=U(Te,2),Ge+=ge.magic,Ge+=U(le,2),Ge+=U(fe,2),Ge+=U(Ce.crc32,4),Ge+=U(Ce.compressedSize,4),Ge+=U(Ce.uncompressedSize,4),Ge+=U(me.length,2),Ge+=U(_e.length,2),{fileRecord:j.LOCAL_FILE_HEADER+Ge+me+_e,dirRecord:j.CENTRAL_FILE_HEADER+U(Ne,2)+Ge+U(pe.length,2)+"\0\0\0\0"+U(Se,4)+U(ie,4)+me+_e+pe}}var q=F("../utils"),Y=F("../stream/GenericWorker"),K=F("../utf8"),Z=F("../crc32"),j=F("../signature");function Q(J,te,ne,ie){Y.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=te,this.zipPlatform=ne,this.encodeFileName=ie,this.streamFiles=J,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}q.inherits(Q,Y),Q.prototype.push=function(J){var te=J.meta.percent||0,ne=this.entriesCount,ie=this._sources.length;this.accumulate?this.contentBuffer.push(J):(this.bytesWritten+=J.data.length,Y.prototype.push.call(this,{data:J.data,meta:{currentFile:this.currentFile,percent:ne?(te+100*(ne-ie-1))/ne:100}}))},Q.prototype.openedSource=function(J){this.currentSourceOffset=this.bytesWritten,this.currentFile=J.file.name;var te=this.streamFiles&&!J.file.dir;if(te){var ne=W(J,te,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:ne.fileRecord,meta:{percent:0}})}else this.accumulate=!0},Q.prototype.closedSource=function(J){this.accumulate=!1;var te=this.streamFiles&&!J.file.dir,ne=W(J,te,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(ne.dirRecord),te)this.push({data:function(ie){return j.DATA_DESCRIPTOR+U(ie.crc32,4)+U(ie.compressedSize,4)+U(ie.uncompressedSize,4)}(J),meta:{percent:100}});else for(this.push({data:ne.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},Q.prototype.flush=function(){for(var J=this.bytesWritten,te=0;te=this.index;Y--)K=(K<<8)+this.byteAt(Y);return this.index+=q,K},readString:function(q){return U.transformTo("string",this.readData(q))},readData:function(q){},lastIndexOfSignature:function(q){},readAndCheckSignature:function(q){},readDate:function(){var q=this.readInt(4);return new Date(Date.UTC(1980+(q>>25&127),(q>>21&15)-1,q>>16&31,q>>11&31,q>>5&63,(31&q)<<1))}},D.exports=W},{"../utils":32}],19:[function(F,D,G){var U=F("./Uint8ArrayReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.readData=function(q){this.checkOffset(q);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(F,D,G){var U=F("./DataReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.byteAt=function(q){return this.data.charCodeAt(this.zero+q)},W.prototype.lastIndexOfSignature=function(q){return this.data.lastIndexOf(q)-this.zero},W.prototype.readAndCheckSignature=function(q){return q===this.readData(4)},W.prototype.readData=function(q){this.checkOffset(q);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./DataReader":18}],21:[function(F,D,G){var U=F("./ArrayReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.readData=function(q){if(this.checkOffset(q),q===0)return new Uint8Array(0);var Y=this.data.subarray(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./ArrayReader":17}],22:[function(F,D,G){var U=F("../utils"),W=F("../support"),q=F("./ArrayReader"),Y=F("./StringReader"),K=F("./NodeBufferReader"),Z=F("./Uint8ArrayReader");D.exports=function(j){var Q=U.getTypeOf(j);return U.checkSupport(Q),Q!=="string"||W.uint8array?Q==="nodebuffer"?new K(j):W.uint8array?new Z(U.transformTo("uint8array",j)):new q(U.transformTo("array",j)):new Y(j)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(F,D,G){G.LOCAL_FILE_HEADER="PK",G.CENTRAL_FILE_HEADER="PK",G.CENTRAL_DIRECTORY_END="PK",G.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",G.ZIP64_CENTRAL_DIRECTORY_END="PK",G.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(F,D,G){var U=F("./GenericWorker"),W=F("../utils");function q(Y){U.call(this,"ConvertWorker to "+Y),this.destType=Y}W.inherits(q,U),q.prototype.processChunk=function(Y){this.push({data:W.transformTo(this.destType,Y.data),meta:Y.meta})},D.exports=q},{"../utils":32,"./GenericWorker":28}],25:[function(F,D,G){var U=F("./GenericWorker"),W=F("../crc32");function q(){U.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}F("../utils").inherits(q,U),q.prototype.processChunk=function(Y){this.streamInfo.crc32=W(Y.data,this.streamInfo.crc32||0),this.push(Y)},D.exports=q},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(F,D,G){var U=F("../utils"),W=F("./GenericWorker");function q(Y){W.call(this,"DataLengthProbe for "+Y),this.propName=Y,this.withStreamInfo(Y,0)}U.inherits(q,W),q.prototype.processChunk=function(Y){if(Y){var K=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=K+Y.data.length}W.prototype.processChunk.call(this,Y)},D.exports=q},{"../utils":32,"./GenericWorker":28}],27:[function(F,D,G){var U=F("../utils"),W=F("./GenericWorker");function q(Y){W.call(this,"DataWorker");var K=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Y.then(function(Z){K.dataIsReady=!0,K.data=Z,K.max=Z&&Z.length||0,K.type=U.getTypeOf(Z),K.isPaused||K._tickAndRepeat()},function(Z){K.error(Z)})}U.inherits(q,W),q.prototype.cleanUp=function(){W.prototype.cleanUp.call(this),this.data=null},q.prototype.resume=function(){return!!W.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,U.delay(this._tickAndRepeat,[],this)),!0)},q.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(U.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},q.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Y=null,K=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":Y=this.data.substring(this.index,K);break;case"uint8array":Y=this.data.subarray(this.index,K);break;case"array":case"nodebuffer":Y=this.data.slice(this.index,K)}return this.index=K,this.push({data:Y,meta:{percent:this.max?this.index/this.max*100:0}})},D.exports=q},{"../utils":32,"./GenericWorker":28}],28:[function(F,D,G){function U(W){this.name=W||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}U.prototype={push:function(W){this.emit("data",W)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(W){this.emit("error",W)}return!0},error:function(W){return!this.isFinished&&(this.isPaused?this.generatedError=W:(this.isFinished=!0,this.emit("error",W),this.previous&&this.previous.error(W),this.cleanUp()),!0)},on:function(W,q){return this._listeners[W].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(W,q){if(this._listeners[W])for(var Y=0;Y "+W:W}},D.exports=U},{}],29:[function(F,D,G){var U=F("../utils"),W=F("./ConvertWorker"),q=F("./GenericWorker"),Y=F("../base64"),K=F("../support"),Z=F("../external"),j=null;if(K.nodestream)try{j=F("../nodejs/NodejsStreamOutputAdapter")}catch{}function Q(te,ne){return new Z.Promise(function(ie,re){var oe=[],le=te._internalType,fe=te._outputType,he=te._mimeType;te.on("data",function(ge,ce){oe.push(ge),ne&&ne(ce)}).on("error",function(ge){oe=[],re(ge)}).on("end",function(){try{var ge=function(ce,me,ye){switch(ce){case"blob":return U.newBlob(U.transformTo("arraybuffer",me),ye);case"base64":return Y.encode(me);default:return U.transformTo(ce,me)}}(fe,function(ce,me){var ye,ve=0,pe=null,be=0;for(ye=0;ye>>6:(ie<65536?ne[le++]=224|ie>>>12:(ne[le++]=240|ie>>>18,ne[le++]=128|ie>>>12&63),ne[le++]=128|ie>>>6&63),ne[le++]=128|63&ie);return ne}(J)},G.utf8decode=function(J){return W.nodebuffer?U.transformTo("nodebuffer",J).toString("utf-8"):function(te){var ne,ie,re,oe,le=te.length,fe=new Array(2*le);for(ne=ie=0;ne>10&1023,fe[ie++]=56320|1023&re)}return fe.length!==ie&&(fe.subarray?fe=fe.subarray(0,ie):fe.length=ie),U.applyFromCharCode(fe)}(J=U.transformTo(W.uint8array?"uint8array":"array",J))},U.inherits(j,Y),j.prototype.processChunk=function(J){var te=U.transformTo(W.uint8array?"uint8array":"array",J.data);if(this.leftOver&&this.leftOver.length){if(W.uint8array){var ne=te;(te=new Uint8Array(ne.length+this.leftOver.length)).set(this.leftOver,0),te.set(ne,this.leftOver.length)}else te=this.leftOver.concat(te);this.leftOver=null}var ie=function(oe,le){var fe;for((le=le||oe.length)>oe.length&&(le=oe.length),fe=le-1;0<=fe&&(192&oe[fe])==128;)fe--;return fe<0||fe===0?le:fe+K[oe[fe]]>le?fe:le}(te),re=te;ie!==te.length&&(W.uint8array?(re=te.subarray(0,ie),this.leftOver=te.subarray(ie,te.length)):(re=te.slice(0,ie),this.leftOver=te.slice(ie,te.length))),this.push({data:G.utf8decode(re),meta:J.meta})},j.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:G.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},G.Utf8DecodeWorker=j,U.inherits(Q,Y),Q.prototype.processChunk=function(J){this.push({data:G.utf8encode(J.data),meta:J.meta})},G.Utf8EncodeWorker=Q},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(F,D,G){var U=F("./support"),W=F("./base64"),q=F("./nodejsUtils"),Y=F("set-immediate-shim"),K=F("./external");function Z(ie){return ie}function j(ie,re){for(var oe=0;oe>8;this.dir=!!(16&this.externalFileAttributes),J==0&&(this.dosPermissions=63&this.externalFileAttributes),J==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(J){if(this.extraFields[1]){var te=U(this.extraFields[1].value);this.uncompressedSize===W.MAX_VALUE_32BITS&&(this.uncompressedSize=te.readInt(8)),this.compressedSize===W.MAX_VALUE_32BITS&&(this.compressedSize=te.readInt(8)),this.localHeaderOffset===W.MAX_VALUE_32BITS&&(this.localHeaderOffset=te.readInt(8)),this.diskNumberStart===W.MAX_VALUE_32BITS&&(this.diskNumberStart=te.readInt(4))}},readExtraFields:function(J){var te,ne,ie,re=J.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});J.index+4>>6:(J<65536?Q[ie++]=224|J>>>12:(Q[ie++]=240|J>>>18,Q[ie++]=128|J>>>12&63),Q[ie++]=128|J>>>6&63),Q[ie++]=128|63&J);return Q},G.buf2binstring=function(j){return Z(j,j.length)},G.binstring2buf=function(j){for(var Q=new U.Buf8(j.length),J=0,te=Q.length;J>10&1023,oe[te++]=56320|1023&ne)}return Z(oe,te)},G.utf8border=function(j,Q){var J;for((Q=Q||j.length)>j.length&&(Q=j.length),J=Q-1;0<=J&&(192&j[J])==128;)J--;return J<0||J===0?Q:J+Y[j[J]]>Q?J:Q}},{"./common":41}],43:[function(F,D,G){D.exports=function(U,W,q,Y){for(var K=65535&U|0,Z=U>>>16&65535|0,j=0;q!==0;){for(q-=j=2e3>>1:W>>>1;q[Y]=W}return q}();D.exports=function(W,q,Y,K){var Z=U,j=K+Y;W^=-1;for(var Q=K;Q>>8^Z[255&(W^q[Q])];return-1^W}},{}],46:[function(F,D,G){var U,W=F("../utils/common"),q=F("./trees"),Y=F("./adler32"),K=F("./crc32"),Z=F("./messages"),j=0,Q=4,J=0,te=-2,ne=-1,ie=4,re=2,oe=8,le=9,fe=286,he=30,ge=19,ce=2*fe+1,me=15,ye=3,ve=258,pe=ve+ye+1,be=42,xe=113,ue=1,_e=2,Be=3,Ae=4;function Pe(Ee,je){return Ee.msg=Z[je],je}function Ie(Ee){return(Ee<<1)-(4Ee.avail_out&&(Ke=Ee.avail_out),Ke!==0&&(W.arraySet(Ee.output,je.pending_buf,je.pending_out,Ke,Ee.next_out),Ee.next_out+=Ke,je.pending_out+=Ke,Ee.total_out+=Ke,Ee.avail_out-=Ke,je.pending-=Ke,je.pending===0&&(je.pending_out=0))}function Se(Ee,je){q._tr_flush_block(Ee,0<=Ee.block_start?Ee.block_start:-1,Ee.strstart-Ee.block_start,je),Ee.block_start=Ee.strstart,Te(Ee.strm)}function Ne(Ee,je){Ee.pending_buf[Ee.pending++]=je}function Ge(Ee,je){Ee.pending_buf[Ee.pending++]=je>>>8&255,Ee.pending_buf[Ee.pending++]=255&je}function ke(Ee,je){var Ke,Oe,Fe=Ee.max_chain_length,He=Ee.strstart,Qe=Ee.prev_length,tt=Ee.nice_match,Xe=Ee.strstart>Ee.w_size-pe?Ee.strstart-(Ee.w_size-pe):0,rt=Ee.window,dt=Ee.w_mask,ct=Ee.prev,bt=Ee.strstart+ve,wt=rt[He+Qe-1],st=rt[He+Qe];Ee.prev_length>=Ee.good_match&&(Fe>>=2),tt>Ee.lookahead&&(tt=Ee.lookahead);do if(rt[(Ke=je)+Qe]===st&&rt[Ke+Qe-1]===wt&&rt[Ke]===rt[He]&&rt[++Ke]===rt[He+1]){He+=2,Ke++;do;while(rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&rt[++He]===rt[++Ke]&&HeXe&&--Fe!=0);return Qe<=Ee.lookahead?Qe:Ee.lookahead}function $e(Ee){var je,Ke,Oe,Fe,He,Qe,tt,Xe,rt,dt,ct=Ee.w_size;do{if(Fe=Ee.window_size-Ee.lookahead-Ee.strstart,Ee.strstart>=ct+(ct-pe)){for(W.arraySet(Ee.window,Ee.window,ct,ct,0),Ee.match_start-=ct,Ee.strstart-=ct,Ee.block_start-=ct,je=Ke=Ee.hash_size;Oe=Ee.head[--je],Ee.head[je]=ct<=Oe?Oe-ct:0,--Ke;);for(je=Ke=ct;Oe=Ee.prev[--je],Ee.prev[je]=ct<=Oe?Oe-ct:0,--Ke;);Fe+=ct}if(Ee.strm.avail_in===0)break;if(Qe=Ee.strm,tt=Ee.window,Xe=Ee.strstart+Ee.lookahead,rt=Fe,dt=void 0,dt=Qe.avail_in,rt=ye)for(He=Ee.strstart-Ee.insert,Ee.ins_h=Ee.window[He],Ee.ins_h=(Ee.ins_h<=ye&&(Ee.ins_h=(Ee.ins_h<=ye)if(Oe=q._tr_tally(Ee,Ee.strstart-Ee.match_start,Ee.match_length-ye),Ee.lookahead-=Ee.match_length,Ee.match_length<=Ee.max_lazy_match&&Ee.lookahead>=ye){for(Ee.match_length--;Ee.strstart++,Ee.ins_h=(Ee.ins_h<=ye&&(Ee.ins_h=(Ee.ins_h<=ye&&Ee.match_length<=Ee.prev_length){for(Fe=Ee.strstart+Ee.lookahead-ye,Oe=q._tr_tally(Ee,Ee.strstart-1-Ee.prev_match,Ee.prev_length-ye),Ee.lookahead-=Ee.prev_length-1,Ee.prev_length-=2;++Ee.strstart<=Fe&&(Ee.ins_h=(Ee.ins_h<Ee.pending_buf_size-5&&(Ke=Ee.pending_buf_size-5);;){if(Ee.lookahead<=1){if($e(Ee),Ee.lookahead===0&&je===j)return ue;if(Ee.lookahead===0)break}Ee.strstart+=Ee.lookahead,Ee.lookahead=0;var Oe=Ee.block_start+Ke;if((Ee.strstart===0||Ee.strstart>=Oe)&&(Ee.lookahead=Ee.strstart-Oe,Ee.strstart=Oe,Se(Ee,!1),Ee.strm.avail_out===0)||Ee.strstart-Ee.block_start>=Ee.w_size-pe&&(Se(Ee,!1),Ee.strm.avail_out===0))return ue}return Ee.insert=0,je===Q?(Se(Ee,!0),Ee.strm.avail_out===0?Be:Ae):(Ee.strstart>Ee.block_start&&(Se(Ee,!1),Ee.strm.avail_out),ue)}),new qe(4,4,8,4,We),new qe(4,5,16,8,We),new qe(4,6,32,32,We),new qe(4,4,16,16,Ve),new qe(8,16,32,32,Ve),new qe(8,16,128,128,Ve),new qe(8,32,128,256,Ve),new qe(32,128,258,1024,Ve),new qe(32,258,258,4096,Ve)],G.deflateInit=function(Ee,je){return lt(Ee,je,oe,15,8,0)},G.deflateInit2=lt,G.deflateReset=ft,G.deflateResetKeep=ot,G.deflateSetHeader=function(Ee,je){return Ee&&Ee.state?Ee.state.wrap!==2?te:(Ee.state.gzhead=je,J):te},G.deflate=function(Ee,je){var Ke,Oe,Fe,He;if(!Ee||!Ee.state||5>8&255),Ne(Oe,Oe.gzhead.time>>16&255),Ne(Oe,Oe.gzhead.time>>24&255),Ne(Oe,Oe.level===9?2:2<=Oe.strategy||Oe.level<2?4:0),Ne(Oe,255&Oe.gzhead.os),Oe.gzhead.extra&&Oe.gzhead.extra.length&&(Ne(Oe,255&Oe.gzhead.extra.length),Ne(Oe,Oe.gzhead.extra.length>>8&255)),Oe.gzhead.hcrc&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending,0)),Oe.gzindex=0,Oe.status=69):(Ne(Oe,0),Ne(Oe,0),Ne(Oe,0),Ne(Oe,0),Ne(Oe,0),Ne(Oe,Oe.level===9?2:2<=Oe.strategy||Oe.level<2?4:0),Ne(Oe,3),Oe.status=xe);else{var Qe=oe+(Oe.w_bits-8<<4)<<8;Qe|=(2<=Oe.strategy||Oe.level<2?0:Oe.level<6?1:Oe.level===6?2:3)<<6,Oe.strstart!==0&&(Qe|=32),Qe+=31-Qe%31,Oe.status=xe,Ge(Oe,Qe),Oe.strstart!==0&&(Ge(Oe,Ee.adler>>>16),Ge(Oe,65535&Ee.adler)),Ee.adler=1}if(Oe.status===69)if(Oe.gzhead.extra){for(Fe=Oe.pending;Oe.gzindex<(65535&Oe.gzhead.extra.length)&&(Oe.pending!==Oe.pending_buf_size||(Oe.gzhead.hcrc&&Oe.pending>Fe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),Te(Ee),Fe=Oe.pending,Oe.pending!==Oe.pending_buf_size));)Ne(Oe,255&Oe.gzhead.extra[Oe.gzindex]),Oe.gzindex++;Oe.gzhead.hcrc&&Oe.pending>Fe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),Oe.gzindex===Oe.gzhead.extra.length&&(Oe.gzindex=0,Oe.status=73)}else Oe.status=73;if(Oe.status===73)if(Oe.gzhead.name){Fe=Oe.pending;do{if(Oe.pending===Oe.pending_buf_size&&(Oe.gzhead.hcrc&&Oe.pending>Fe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),Te(Ee),Fe=Oe.pending,Oe.pending===Oe.pending_buf_size)){He=1;break}He=Oe.gzindexFe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),He===0&&(Oe.gzindex=0,Oe.status=91)}else Oe.status=91;if(Oe.status===91)if(Oe.gzhead.comment){Fe=Oe.pending;do{if(Oe.pending===Oe.pending_buf_size&&(Oe.gzhead.hcrc&&Oe.pending>Fe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),Te(Ee),Fe=Oe.pending,Oe.pending===Oe.pending_buf_size)){He=1;break}He=Oe.gzindexFe&&(Ee.adler=K(Ee.adler,Oe.pending_buf,Oe.pending-Fe,Fe)),He===0&&(Oe.status=103)}else Oe.status=103;if(Oe.status===103&&(Oe.gzhead.hcrc?(Oe.pending+2>Oe.pending_buf_size&&Te(Ee),Oe.pending+2<=Oe.pending_buf_size&&(Ne(Oe,255&Ee.adler),Ne(Oe,Ee.adler>>8&255),Ee.adler=0,Oe.status=xe)):Oe.status=xe),Oe.pending!==0){if(Te(Ee),Ee.avail_out===0)return Oe.last_flush=-1,J}else if(Ee.avail_in===0&&Ie(je)<=Ie(Ke)&&je!==Q)return Pe(Ee,-5);if(Oe.status===666&&Ee.avail_in!==0)return Pe(Ee,-5);if(Ee.avail_in!==0||Oe.lookahead!==0||je!==j&&Oe.status!==666){var tt=Oe.strategy===2?function(Xe,rt){for(var dt;;){if(Xe.lookahead===0&&($e(Xe),Xe.lookahead===0)){if(rt===j)return ue;break}if(Xe.match_length=0,dt=q._tr_tally(Xe,0,Xe.window[Xe.strstart]),Xe.lookahead--,Xe.strstart++,dt&&(Se(Xe,!1),Xe.strm.avail_out===0))return ue}return Xe.insert=0,rt===Q?(Se(Xe,!0),Xe.strm.avail_out===0?Be:Ae):Xe.last_lit&&(Se(Xe,!1),Xe.strm.avail_out===0)?ue:_e}(Oe,je):Oe.strategy===3?function(Xe,rt){for(var dt,ct,bt,wt,st=Xe.window;;){if(Xe.lookahead<=ve){if($e(Xe),Xe.lookahead<=ve&&rt===j)return ue;if(Xe.lookahead===0)break}if(Xe.match_length=0,Xe.lookahead>=ye&&0Xe.lookahead&&(Xe.match_length=Xe.lookahead)}if(Xe.match_length>=ye?(dt=q._tr_tally(Xe,1,Xe.match_length-ye),Xe.lookahead-=Xe.match_length,Xe.strstart+=Xe.match_length,Xe.match_length=0):(dt=q._tr_tally(Xe,0,Xe.window[Xe.strstart]),Xe.lookahead--,Xe.strstart++),dt&&(Se(Xe,!1),Xe.strm.avail_out===0))return ue}return Xe.insert=0,rt===Q?(Se(Xe,!0),Xe.strm.avail_out===0?Be:Ae):Xe.last_lit&&(Se(Xe,!1),Xe.strm.avail_out===0)?ue:_e}(Oe,je):U[Oe.level].func(Oe,je);if(tt!==Be&&tt!==Ae||(Oe.status=666),tt===ue||tt===Be)return Ee.avail_out===0&&(Oe.last_flush=-1),J;if(tt===_e&&(je===1?q._tr_align(Oe):je!==5&&(q._tr_stored_block(Oe,0,0,!1),je===3&&(Ce(Oe.head),Oe.lookahead===0&&(Oe.strstart=0,Oe.block_start=0,Oe.insert=0))),Te(Ee),Ee.avail_out===0))return Oe.last_flush=-1,J}return je!==Q?J:Oe.wrap<=0?1:(Oe.wrap===2?(Ne(Oe,255&Ee.adler),Ne(Oe,Ee.adler>>8&255),Ne(Oe,Ee.adler>>16&255),Ne(Oe,Ee.adler>>24&255),Ne(Oe,255&Ee.total_in),Ne(Oe,Ee.total_in>>8&255),Ne(Oe,Ee.total_in>>16&255),Ne(Oe,Ee.total_in>>24&255)):(Ge(Oe,Ee.adler>>>16),Ge(Oe,65535&Ee.adler)),Te(Ee),0=Ke.w_size&&(He===0&&(Ce(Ke.head),Ke.strstart=0,Ke.block_start=0,Ke.insert=0),rt=new W.Buf8(Ke.w_size),W.arraySet(rt,je,dt-Ke.w_size,Ke.w_size,0),je=rt,dt=Ke.w_size),Qe=Ee.avail_in,tt=Ee.next_in,Xe=Ee.input,Ee.avail_in=dt,Ee.next_in=0,Ee.input=je,$e(Ke);Ke.lookahead>=ye;){for(Oe=Ke.strstart,Fe=Ke.lookahead-(ye-1);Ke.ins_h=(Ke.ins_h<>>=ye=me>>>24,le-=ye,(ye=me>>>16&255)===0)_e[Z++]=65535&me;else{if(!(16&ye)){if((64&ye)==0){me=fe[(65535&me)+(oe&(1<>>=ye,le-=ye),le<15&&(oe+=ue[Y++]<>>=ye=me>>>24,le-=ye,!(16&(ye=me>>>16&255))){if((64&ye)==0){me=he[(65535&me)+(oe&(1<>>=ye,le-=ye,(ye=Z-j)>3,oe&=(1<<(le-=ve<<3))-1,U.next_in=Y,U.next_out=Z,U.avail_in=Y>>24&255)+(be>>>8&65280)+((65280&be)<<8)+((255&be)<<24)}function oe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U.Buf16(320),this.work=new U.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function le(be){var xe;return be&&be.state?(xe=be.state,be.total_in=be.total_out=xe.total=0,be.msg="",xe.wrap&&(be.adler=1&xe.wrap),xe.mode=te,xe.last=0,xe.havedict=0,xe.dmax=32768,xe.head=null,xe.hold=0,xe.bits=0,xe.lencode=xe.lendyn=new U.Buf32(ne),xe.distcode=xe.distdyn=new U.Buf32(ie),xe.sane=1,xe.back=-1,Q):J}function fe(be){var xe;return be&&be.state?((xe=be.state).wsize=0,xe.whave=0,xe.wnext=0,le(be)):J}function he(be,xe){var ue,_e;return be&&be.state?(_e=be.state,xe<0?(ue=0,xe=-xe):(ue=1+(xe>>4),xe<48&&(xe&=15)),xe&&(xe<8||15=Ae.wsize?(U.arraySet(Ae.window,xe,ue-Ae.wsize,Ae.wsize,0),Ae.wnext=0,Ae.whave=Ae.wsize):(_e<(Be=Ae.wsize-Ae.wnext)&&(Be=_e),U.arraySet(Ae.window,xe,ue-_e,Be,Ae.wnext),(_e-=Be)?(U.arraySet(Ae.window,xe,ue-_e,_e,0),Ae.wnext=_e,Ae.whave=Ae.wsize):(Ae.wnext+=Be,Ae.wnext===Ae.wsize&&(Ae.wnext=0),Ae.whave>>8&255,ue.check=q(ue.check,He,2,0),Se=Te=0,ue.mode=2;break}if(ue.flags=0,ue.head&&(ue.head.done=!1),!(1&ue.wrap)||(((255&Te)<<8)+(Te>>8))%31){be.msg="incorrect header check",ue.mode=30;break}if((15&Te)!=8){be.msg="unknown compression method",ue.mode=30;break}if(Se-=4,Ee=8+(15&(Te>>>=4)),ue.wbits===0)ue.wbits=Ee;else if(Ee>ue.wbits){be.msg="invalid window size",ue.mode=30;break}ue.dmax=1<>8&1),512&ue.flags&&(He[0]=255&Te,He[1]=Te>>>8&255,ue.check=q(ue.check,He,2,0)),Se=Te=0,ue.mode=3;case 3:for(;Se<32;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>8&255,He[2]=Te>>>16&255,He[3]=Te>>>24&255,ue.check=q(ue.check,He,4,0)),Se=Te=0,ue.mode=4;case 4:for(;Se<16;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>8),512&ue.flags&&(He[0]=255&Te,He[1]=Te>>>8&255,ue.check=q(ue.check,He,2,0)),Se=Te=0,ue.mode=5;case 5:if(1024&ue.flags){for(;Se<16;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>8&255,ue.check=q(ue.check,He,2,0)),Se=Te=0}else ue.head&&(ue.head.extra=null);ue.mode=6;case 6:if(1024&ue.flags&&(Ie<(ke=ue.length)&&(ke=Ie),ke&&(ue.head&&(Ee=ue.head.extra_len-ue.length,ue.head.extra||(ue.head.extra=new Array(ue.head.extra_len)),U.arraySet(ue.head.extra,_e,Ae,ke,Ee)),512&ue.flags&&(ue.check=q(ue.check,_e,ke,Ae)),Ie-=ke,Ae+=ke,ue.length-=ke),ue.length))break e;ue.length=0,ue.mode=7;case 7:if(2048&ue.flags){if(Ie===0)break e;for(ke=0;Ee=_e[Ae+ke++],ue.head&&Ee&&ue.length<65536&&(ue.head.name+=String.fromCharCode(Ee)),Ee&&ke>9&1,ue.head.done=!0),be.adler=ue.check=0,ue.mode=12;break;case 10:for(;Se<32;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>=7&Se,Se-=7&Se,ue.mode=27;break}for(;Se<3;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>=1)){case 0:ue.mode=14;break;case 1:if(ve(ue),ue.mode=20,xe!==6)break;Te>>>=2,Se-=2;break e;case 2:ue.mode=17;break;case 3:be.msg="invalid block type",ue.mode=30}Te>>>=2,Se-=2;break;case 14:for(Te>>>=7&Se,Se-=7&Se;Se<32;){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>16^65535)){be.msg="invalid stored block lengths",ue.mode=30;break}if(ue.length=65535&Te,Se=Te=0,ue.mode=15,xe===6)break e;case 15:ue.mode=16;case 16:if(ke=ue.length){if(Ie>>=5,Se-=5,ue.ndist=1+(31&Te),Te>>>=5,Se-=5,ue.ncode=4+(15&Te),Te>>>=4,Se-=4,286>>=3,Se-=3}for(;ue.have<19;)ue.lens[Qe[ue.have++]]=0;if(ue.lencode=ue.lendyn,ue.lenbits=7,Ke={bits:ue.lenbits},je=K(0,ue.lens,0,19,ue.lencode,0,ue.work,Ke),ue.lenbits=Ke.bits,je){be.msg="invalid code lengths set",ue.mode=30;break}ue.have=0,ue.mode=19;case 19:for(;ue.have>>16&255,et=65535&Fe,!((Ve=Fe>>>24)<=Se);){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>=Ve,Se-=Ve,ue.lens[ue.have++]=et;else{if(et===16){for(Oe=Ve+2;Se>>=Ve,Se-=Ve,ue.have===0){be.msg="invalid bit length repeat",ue.mode=30;break}Ee=ue.lens[ue.have-1],ke=3+(3&Te),Te>>>=2,Se-=2}else if(et===17){for(Oe=Ve+3;Se>>=Ve)),Te>>>=3,Se-=3}else{for(Oe=Ve+7;Se>>=Ve)),Te>>>=7,Se-=7}if(ue.have+ke>ue.nlen+ue.ndist){be.msg="invalid bit length repeat",ue.mode=30;break}for(;ke--;)ue.lens[ue.have++]=Ee}}if(ue.mode===30)break;if(ue.lens[256]===0){be.msg="invalid code -- missing end-of-block",ue.mode=30;break}if(ue.lenbits=9,Ke={bits:ue.lenbits},je=K(Z,ue.lens,0,ue.nlen,ue.lencode,0,ue.work,Ke),ue.lenbits=Ke.bits,je){be.msg="invalid literal/lengths set",ue.mode=30;break}if(ue.distbits=6,ue.distcode=ue.distdyn,Ke={bits:ue.distbits},je=K(j,ue.lens,ue.nlen,ue.ndist,ue.distcode,0,ue.work,Ke),ue.distbits=Ke.bits,je){be.msg="invalid distances set",ue.mode=30;break}if(ue.mode=20,xe===6)break e;case 20:ue.mode=21;case 21:if(6<=Ie&&258<=Ce){be.next_out=Pe,be.avail_out=Ce,be.next_in=Ae,be.avail_in=Ie,ue.hold=Te,ue.bits=Se,Y(be,Ge),Pe=be.next_out,Be=be.output,Ce=be.avail_out,Ae=be.next_in,_e=be.input,Ie=be.avail_in,Te=ue.hold,Se=ue.bits,ue.mode===12&&(ue.back=-1);break}for(ue.back=0;qe=(Fe=ue.lencode[Te&(1<>>16&255,et=65535&Fe,!((Ve=Fe>>>24)<=Se);){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>ot)])>>>16&255,et=65535&Fe,!(ot+(Ve=Fe>>>24)<=Se);){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>=ot,Se-=ot,ue.back+=ot}if(Te>>>=Ve,Se-=Ve,ue.back+=Ve,ue.length=et,qe===0){ue.mode=26;break}if(32&qe){ue.back=-1,ue.mode=12;break}if(64&qe){be.msg="invalid literal/length code",ue.mode=30;break}ue.extra=15&qe,ue.mode=22;case 22:if(ue.extra){for(Oe=ue.extra;Se>>=ue.extra,Se-=ue.extra,ue.back+=ue.extra}ue.was=ue.length,ue.mode=23;case 23:for(;qe=(Fe=ue.distcode[Te&(1<>>16&255,et=65535&Fe,!((Ve=Fe>>>24)<=Se);){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>ot)])>>>16&255,et=65535&Fe,!(ot+(Ve=Fe>>>24)<=Se);){if(Ie===0)break e;Ie--,Te+=_e[Ae++]<>>=ot,Se-=ot,ue.back+=ot}if(Te>>>=Ve,Se-=Ve,ue.back+=Ve,64&qe){be.msg="invalid distance code",ue.mode=30;break}ue.offset=et,ue.extra=15&qe,ue.mode=24;case 24:if(ue.extra){for(Oe=ue.extra;Se>>=ue.extra,Se-=ue.extra,ue.back+=ue.extra}if(ue.offset>ue.dmax){be.msg="invalid distance too far back",ue.mode=30;break}ue.mode=25;case 25:if(Ce===0)break e;if(ke=Ge-Ce,ue.offset>ke){if((ke=ue.offset-ke)>ue.whave&&ue.sane){be.msg="invalid distance too far back",ue.mode=30;break}$e=ke>ue.wnext?(ke-=ue.wnext,ue.wsize-ke):ue.wnext-ke,ke>ue.length&&(ke=ue.length),We=ue.window}else We=Be,$e=Pe-ue.offset,ke=ue.length;for(Cece?(ye=$e[We+ie[xe]],Se[Ne+ie[xe]]):(ye=96,0),oe=1<>Pe)+(le-=oe)]=me<<24|ye<<16|ve|0,le!==0;);for(oe=1<>=1;if(oe!==0?(Te&=oe-1,Te+=oe):Te=0,xe++,--Ge[be]==0){if(be===_e)break;be=j[Q+ie[xe]]}if(Be>>7)]}function Ne(Fe,He){Fe.pending_buf[Fe.pending++]=255&He,Fe.pending_buf[Fe.pending++]=He>>>8&255}function Ge(Fe,He,Qe){Fe.bi_valid>re-Qe?(Fe.bi_buf|=He<>re-Fe.bi_valid,Fe.bi_valid+=Qe-re):(Fe.bi_buf|=He<>>=1,Qe<<=1,0<--He;);return Qe>>>1}function We(Fe,He,Qe){var tt,Xe,rt=new Array(ie+1),dt=0;for(tt=1;tt<=ie;tt++)rt[tt]=dt=dt+Qe[tt-1]<<1;for(Xe=0;Xe<=He;Xe++){var ct=Fe[2*Xe+1];ct!==0&&(Fe[2*Xe]=$e(rt[ct]++,ct))}}function Ve(Fe){var He;for(He=0;He>1;1<=Qe;Qe--)ot(Fe,rt,Qe);for(Xe=bt;Qe=Fe.heap[1],Fe.heap[1]=Fe.heap[Fe.heap_len--],ot(Fe,rt,1),tt=Fe.heap[1],Fe.heap[--Fe.heap_max]=Qe,Fe.heap[--Fe.heap_max]=tt,rt[2*Xe]=rt[2*Qe]+rt[2*tt],Fe.depth[Xe]=(Fe.depth[Qe]>=Fe.depth[tt]?Fe.depth[Qe]:Fe.depth[tt])+1,rt[2*Qe+1]=rt[2*tt+1]=Xe,Fe.heap[1]=Xe++,ot(Fe,rt,1),2<=Fe.heap_len;);Fe.heap[--Fe.heap_max]=Fe.heap[1],function(st,xt){var Nt,$t,ai,Ot,Kt,Qt,mt=xt.dyn_tree,ri=xt.max_code,ui=xt.stat_desc.static_tree,Zt=xt.stat_desc.has_stree,$i=xt.stat_desc.extra_bits,yi=xt.stat_desc.extra_base,Wt=xt.stat_desc.max_length,Ki=0;for(Ot=0;Ot<=ie;Ot++)st.bl_count[Ot]=0;for(mt[2*st.heap[st.heap_max]+1]=0,Nt=st.heap_max+1;Nt>=7;Xe>>=1)if(1&wt&&ct.dyn_ltree[2*bt]!==0)return W;if(ct.dyn_ltree[18]!==0||ct.dyn_ltree[20]!==0||ct.dyn_ltree[26]!==0)return q;for(bt=32;bt>>3,(rt=Fe.static_len+3+7>>>3)<=Xe&&(Xe=rt)):Xe=rt=Qe+5,Qe+4<=Xe&&He!==-1?Oe(Fe,He,Qe,tt):Fe.strategy===4||rt===Xe?(Ge(Fe,2+(tt?1:0),3),ft(Fe,pe,be)):(Ge(Fe,4+(tt?1:0),3),function(ct,bt,wt,st){var xt;for(Ge(ct,bt-257,5),Ge(ct,wt-1,5),Ge(ct,st-4,4),xt=0;xt>>8&255,Fe.pending_buf[Fe.d_buf+2*Fe.last_lit+1]=255&He,Fe.pending_buf[Fe.l_buf+Fe.last_lit]=255&Qe,Fe.last_lit++,He===0?Fe.dyn_ltree[2*Qe]++:(Fe.matches++,He--,Fe.dyn_ltree[2*(ue[Qe]+j+1)]++,Fe.dyn_dtree[2*Se(He)]++),Fe.last_lit===Fe.lit_bufsize-1},G._tr_align=function(Fe){Ge(Fe,2,3),ke(Fe,le,pe),function(He){He.bi_valid===16?(Ne(He,He.bi_buf),He.bi_buf=0,He.bi_valid=0):8<=He.bi_valid&&(He.pending_buf[He.pending++]=255&He.bi_buf,He.bi_buf>>=8,He.bi_valid-=8)}(Fe)}},{"../utils/common":41}],53:[function(F,D,G){D.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(F,D,G){D.exports=typeof setImmediate=="function"?setImmediate:function(){var U=[].slice.apply(arguments);U.splice(1,0,0),setTimeout.apply(null,U)}},{}]},{},[10])(10)})})(jszip_min);var JSZip=jszip_min.exports;class MXLHelper{static MXLtoIXmlElement(R){const F=new JSZip;return F.loadAsync(R).then(U=>F.file("META-INF/container.xml").async("text"),U=>{throw U}).then(U=>{const Y=new DOMParser().parseFromString(U,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return F.file(Y).async("text")},U=>{throw U}).then(U=>{const q=new DOMParser().parseFromString(U,"text/xml"),Y=new IXmlElement(q.documentElement);return Promise.resolve(Y)},U=>{throw U}).then(U=>U,U=>{throw new Error("extractSheetFromMxl: "+U.message)})}static MXLtoXMLstring(R){const F=new JSZip;return F.loadAsync(R).then(D=>F.file("META-INF/container.xml").async("text"),D=>{throw log$2.error(D),D}).then(D=>{const W=new DOMParser().parseFromString(D,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return F.file(W).async("text")},D=>{throw D})}}class PlaybackNoteGenerator{calculate(R){const F=new MusicPartManagerIterator(R);for(;!F.EndReached;){const D=F.CurrentEnrolledTimestamp,G=F.CurrentAudibleVoiceEntries();for(const U of G)this.handleVoiceEntry(R,U,D);F.moveToNext()}}handleVoiceEntry(R,F,D){if(F.IsGrace)return;const G=F.ParentVoice;let U;R.PlaybackDataDict.containsKey(G)?U=R.PlaybackDataDict.getValue(G):(U=[],R.PlaybackDataDict.setValue(G,U));for(const W of F.PlaybackEntries)if(W.HasNotes){for(const Y of W.Notes)Y.setLength();const q=Fraction$1.plus(D,W.TimestampShift);PlaybackNoteGenerator.addEntrySorted(U,W,q)}}static addEntrySorted(R,F,D){if(R.length===0)R.push({enrolledTimestamp:D,playbackEntry:F});else for(let G=R.length-1;G>=0;G--){const U=R[G];if(D.RealValue>U.enrolledTimestamp.RealValue)if(G===R.length-1){R.push({enrolledTimestamp:D,playbackEntry:F});break}else{R.splice(G+1,0,{enrolledTimestamp:D,playbackEntry:F});break}}}}class ScreenViewingRegion{constructor(R,F,D,G){this.psi=new BoundingBox$2(void 0),this.displaySizeInPixel=R,this.RelativeDisplaySize=F,this.RelativeDisplayPosition=D,this.WidthInUnits=G}static createWithRelativeDefaults(R,F){return new ScreenViewingRegion(R,new SizeF2D(1,1),new PointF2D(0,0),F)}static createWithDefaults(){return new ScreenViewingRegion(new SizeF2D(1,1),new SizeF2D(1,1),new PointF2D(0,0),1)}get UpperLeftPositionInUnits(){return this.psi.AbsolutePosition}set UpperLeftPositionInUnits(R){this.psi.AbsolutePosition=R}get DisplaySizeInPixel(){return this.displaySizeInPixel}set DisplaySizeInPixel(R){this.displaySizeInPixel=R,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RelativeDisplaySize(){return this.relativeRegionSize}set RelativeDisplaySize(R){this.relativeRegionSize=R,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RegionSizeInPixel(){return this.regionSizeInPixel}get WidthInUnits(){return this.psi.BorderRight}set WidthInUnits(R){this.psi.BorderRight=R,this.recalculateDependentVariables()}get ViewRegionInUnits(){return new SizeF2D(this.psi.BorderRight,this.psi.BorderBottom)}isVisible(R,F){const D=this.psi.collisionDetection(R);return this.psi.liesInsideBorders(R),D}isInsideDisplayArea(R,F){return this.RelativeDisplayPosition.x<=R&&R<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=F&&F<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}transformToUnitCoordinates(R){return new PointF2D(this.UpperLeftPositionInUnits.x+this.ViewRegionInUnits.width*((R.x-this.RelativeDisplayPosition.x)/this.RelativeDisplaySize.width),this.UpperLeftPositionInUnits.y+this.ViewRegionInUnits.height*((R.y-this.RelativeDisplayPosition.y)/this.RelativeDisplaySize.height))}transformLengthXToUnitCoordinates(R){return R/this.horizontalUnitToPixelRatio}transformLengthYToUnitCoordinates(R){return R/this.verticalUnitToPixelRatio}recalculateDependentVariables(){const R=this.regionSizeInPixel.width/this.regionSizeInPixel.height;this.psi.BorderBottom=this.psi.BorderRight/R,this.horizontalUnitToPixelRatio=this.regionSizeInPixel.width/this.ViewRegionInUnits.width,this.verticalUnitToPixelRatio=this.regionSizeInPixel.height/this.ViewRegionInUnits.height}}class AbstractZoomView{constructor(R){this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=R,this.displayInteractionManager.addListener(this),this.offsetXMin=Number.MIN_VALUE,this.offsetYMin=Number.MIN_VALUE,this.rangeXMin=1,this.rangeYMin=1,this.offsetXMax=Number.MAX_VALUE,this.offsetYMax=Number.MAX_VALUE,this.rangeXMax=1e9,this.rangeYMax=1e9,this.XScrollingEnabled=!1,this.YScrollingEnabled=!0}positionTouched(R,F){if(!this.convertToUnitsReady())return;const D=this.getPositionInUnits(R,F);this.unitPosTouched(D,R,F)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(R,F){if(!this.convertToUnitsReady())return;const D=this.getPositionInUnits(R,F);this.unitPosDoubleTouched(D,R,F)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(R){this.usesManuallyControlledZoomMode=R}mouseDown(R,F,D=!1){if(!this.convertToUnitsReady())return;this.selectScrollControllerY(!1),this.lastRangeX=Math.max(1,this.RangeX),this.lastRangeY=Math.max(1,this.RangeY),this.lastOffsetX=this.OffsetX,this.lastOffsetY=this.OffsetY;const G=this.getPositionInUnits(R,F);this.unitPosTouchDown(G,R,F),this.usesManuallyControlledZoomMode||(D?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(R,F){const D=this.getPositionInUnits(R,F);this.unitPosTouchUp(D,R,F)}mouseMove(R,F,D,G){this.mouseZoomMode?(Math.abs(D-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+D))),!this.lockRanges&&Math.abs(G-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-G)))):(Math.abs(D-0)>1e-8&&(this.OffsetX=this.lastOffsetX-D*this.RangeX),Math.abs(G-0)>1e-8&&(this.OffsetY=this.lastOffsetY-G*this.RangeY));const U=this.getPositionInUnits(R,F);this.unitPosMove(U,R,F)}zoom(R){this.RangeX=Math.abs(this.lastRangeX/R)}addZoomView(R){this.zoomViews.push(R)}get OffsetX(){return this.offsetX}set OffsetX(R){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,R));for(const F of this.zoomViews)F.viewportXChanged(this.offsetX,this.RangeX)}get OffsetY(){return this.offsetY}set OffsetY(R){this.offsetY=R,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetY(B[B.SingleTouch=0]="SingleTouch",B[B.DoubleTouch=1]="DoubleTouch",B[B.TouchUp=2]="TouchUp",B[B.TouchDown=3]="TouchDown",B[B.Move=4]="Move",B))(InteractionType||{});class VoiceEntryInteractionListener{constructor(R){this.renderingManager=R}userDisplayInteraction(R,F,D){var G,U;switch(D){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const W=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(F);W&&W.parentStaffEntry.parentVerticalContainer!==void 0&&((G=W.notes[0])==null?void 0:G.sourceNote.Pitch)!==void 0&&((U=this.renderingManager.PlaybackManager)==null||U.playVoiceEntry(W.parentVoiceEntry));break}}}}class SheetRenderingManager extends AbstractZoomView{constructor(R,F){super(R),this.mainViewingRegion=ScreenViewingRegion.createWithDefaults(),this.tryAgainToRenderCount=0,this.yOffsetMouseDown=Number.MIN_VALUE,this.unlockCursorDistancePixel=50,this.relativeTopPosition=.06,this.internalPreviewImageScale=3,this.listeners=[],this.LockDisplayToCursor=!0,this.ZoomActive=!1,this.rules=F,this.addZoomView(this),this.lockRanges=!0,this.TopBarHeightInPixel=70,this.BottomBarHeightInPixel=0,this.rules.UseDefaultVoiceInteractionListener&&this.listeners.push(new VoiceEntryInteractionListener(this))}addListener(R){this.listeners.push(R)}get Listeners(){return this.listeners}convertToUnitsReady(){return this.graphicalMusicSheet!==void 0}unitPosTouched(R,F,D){if(!this.SingleTouchDisabled){const G=new PointF2D(F,D);this.handleUserDisplayInteraction(G,R,InteractionType.SingleTouch)}}unitPosDoubleTouched(R,F,D){if(!this.DoubleTouchDisabled){const G=new PointF2D(F,D);this.handleUserDisplayInteraction(G,R,InteractionType.DoubleTouch)}}unitPosTouchDown(R,F,D){const G=new PointF2D(F,D);this.handleUserDisplayInteraction(G,R,InteractionType.TouchDown),this.yOffsetMouseDown=R.y}unitPosTouchUp(R,F,D){const G=new PointF2D(F,D);this.handleUserDisplayInteraction(G,R,InteractionType.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(R),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(R,F,D){const G=new PointF2D(F,D);this.handleUserDisplayInteraction(G,R,InteractionType.Move),this.unlockFromCursorIfNecessary(R)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(R){this.graphicalMusicSheet=R,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(R,F){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(R,F)}viewportYChanged(R,F){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=R),this.verticalViewportChanged(R,F))}displaySizeChanged(R,F){super.viewSizeChanged(R,F),!(Math.abs(R-0)<1e-7||Math.abs(F-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new SizeF2D(R,F),this.adaptDisplayLimitsToSheet())}calcDisplayYPosition(R){return R.PositionAndShape.AbsolutePosition.y+R.PositionAndShape.BorderMarginTop-this.topBarHeightInUnits()-this.relativeTopPosition*this.heightWithoutTopBottomBarsInUnits()}yPositionForLastSystem(R){return R.PositionAndShape.AbsolutePosition.y+R.PositionAndShape.BorderMarginBottom-this.topBarHeightInUnits()-(1-this.relativeTopPosition)*this.heightWithoutTopBottomBarsInUnits()}scorePositionChanged(R,F,D,G,U,W){const q=this.calcDisplayYPosition(G);this.setYPosition(q,W)}setXPosition(R,F){this.LockDisplayToCursor&&this.setXOffset(R,F)}setYPosition(R,F){this.LockDisplayToCursor&&this.setYOffset(R,F)}get DrawingParameters(){return this.musicSheetDrawer.drawingParameters}topBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.TopBarHeightInPixel)}bottomBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.BottomBarHeightInPixel)}heightWithoutTopBottomBarsInUnits(){return this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits()}activePositionToBottomBarHeight(){return(this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits())*(1-2*this.relativeTopPosition)}getClickPosition(R,F){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(R,F))}graphicalObjectIsVisible(R){return this.mainViewingRegion.isVisible(R,!1)}adaptDisplayLimitsToSheet(){if(this.graphicalMusicSheet===void 0||this.graphicalMusicSheet.MusicPages.length===0||this.graphicalMusicSheet.MusicPages[0].MusicSystems.length===0)return;this.offsetXMin=0,this.rangeXMin=this.graphicalMusicSheet.MinAllowedSystemWidth,this.rangeXMax=300,this.offsetYMin=-.3*this.RangeY;const R=this.graphicalMusicSheet.MusicPages.last().PositionAndShape;this.offsetYMax=Math.max(0,R.BorderMarginBottom-.7*this.RangeY),this.OffsetY>this.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}horizontalViewportChanged(R,F){this.mainViewingRegion.WidthInUnits!==F&&(this.mainViewingRegion.WidthInUnits=F)}verticalViewportChanged(R,F){this.mainViewingRegion.UpperLeftPositionInUnits=new PointF2D(this.mainViewingRegion.UpperLeftPositionInUnits.x,R)}unlockFromCursorIfNecessary(R){if(this.LockDisplayToCursor===!1||this.ZoomActive||this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive)return;Math.abs((R.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1)}getPositionInUnits(R,F){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(R,F))}handleUserDisplayInteraction(R,F,D){switch(D){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const G=this.graphicalMusicSheet.GetNearestVoiceEntry(F);if(G){const U=new CustomEvent("note-click",{detail:{...G,setAvtivePlay:()=>{var W,q;if(G.parentStaffEntry.parentVerticalContainer!==void 0){const Y=G.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(Y),((W=G.notes[0])==null?void 0:W.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",G.parentVoiceEntry),(q=this.PlaybackManager)==null||q.playVoiceEntry(G.parentVoiceEntry))}}}});window.dispatchEvent(U)}}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:for(const G of this.listeners)G.userDisplayInteraction(R,F,D);break;default:throw new Error("type")}}setStartPosition(R){var F;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=R,(F=this.PlaybackManager)==null||F.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class WebSheetRenderingManager extends SheetRenderingManager{mouseMove(R,F,D,G){const U=this.getPositionInUnits(R,F);this.unitPosMove(U,R,F)}}class AbstractDisplayInteractionManager{constructor(){this.listeners=[],this.zoomGestureActive=!1,this.touchCount=0,this.touchActive=!1,this.touchMoving=!1,this.displayWidth=1,this.displayHeight=1,this.displayDpi=96,this.maxNumerOfFingers=2,this.movementThreshInch=.075,this.interactionWasZoomGesture=!1}addListener(R){this.listeners.push(R)}get ZoomGestureActive(){return this.zoomGestureActive}get WasZoomGestureActive(){return this.interactionWasZoomGesture}displaySizeChanged(R,F){this.displayWidth=R,this.displayHeight=F;for(const D of this.listeners)D.displaySizeChanged(this.displayWidth,this.displayHeight)}Dispose(){this.dispose()}Initialize(){this.initialize()}get DisplayDpi(){return this.displayDpi}get TouchActive(){return this.touchActive}get TouchMoving(){return this.touchMoving}touchDown(R,F,D){this.interactionWasZoomGesture=!1;const G=R/this.displayWidth,U=F/this.displayHeight;this.lastRelPosX=G,this.lastRelPosY=U,this.lastPixelX=R,this.lastPixelY=F,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const W of this.listeners)W.mouseDown(G,U,!D)}move(R,F){if(this.touchActive&&!this.zoomGestureActive){const D=R/this.displayWidth,G=F/this.displayHeight,U=D-this.lastRelPosX,W=G-this.lastRelPosY;this.touchMoving=!0;for(const q of this.listeners)q.mouseMove(D,G,U,W)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(R){this.zoomGestureActive&&this.listeners.forEach(function(F){F.zoom(R)})}touchUp(R,F){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const D=R/this.displayWidth,G=F/this.displayHeight;for(const U of this.listeners)U.mouseUp(D,G)}click(R,F){if(!this.mouseDidMove(this.lastPixelX,R,this.lastPixelY,F)&&!this.ZoomGestureActive){const D=R/this.displayWidth,G=F/this.displayHeight;for(const U of this.listeners)U.positionTouched(D,G)}}doubleClick(R,F){if(!this.mouseDidMove(this.lastPixelX,R,this.lastPixelY,F)&&!this.ZoomGestureActive){const D=R/this.displayWidth,G=F/this.displayHeight;for(const U of this.listeners)U.positionDoubleTouched(D,G)}}mouseDidMove(R,F,D,G){const U=Math.abs(R-F)/this.displayDpi,W=Math.abs(D-G)/this.displayDpi;return U>this.movementThreshInch||W>this.movementThreshInch}}class WebDisplayInteractionManager extends AbstractDisplayInteractionManager{constructor(R){super(),this.fullOffsetLeft=0,this.fullOffsetTop=0,this.fullScrollTop=0,this.fullScrollLeft=0,this.parentScrollMap=new Map,this.scrollCallbackMap=new Map,this.timeout=void 0,this.resizeObserver=void 0,this.EventCallbackMap=new Dictionary,this.DOUBLE_CLICK_WINDOW=200,this.lastClick=0,this.osmdSheetMusicContainer=R,this.listenForInteractions()}get FullOffsetTop(){return this.fullOffsetTop}get FullScrollTop(){return this.fullScrollTop}get FullOffsetLeft(){return this.fullOffsetLeft}get FullScrollLeft(){return this.fullScrollLeft}static resizeCallback(R,F){clearTimeout(F.timeout),F.timeout=setTimeout(()=>{F.fullOffsetLeft=0,F.fullOffsetTop=0;let D=F.osmdSheetMusicContainer;for(;D;)F.fullOffsetLeft+=D.offsetLeft,F.fullOffsetTop+=D.offsetTop,D=D.offsetParent;F.resizeEventListener(),F.deregisterScrollOffsets(),F.registerScrollOffsets()},500)}registerScrollOffsets(){let R=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const F=this;for(;R&&R!==document.documentElement;){if(this.parentScrollMap.set(R,[R.scrollTop,R.scrollLeft]),this.fullScrollLeft+=R.scrollLeft,this.fullScrollTop+=R.scrollTop,R.scrollHeight>R.clientHeight){const D=function(G){const U=F.parentScrollMap.get(this),W=U[0],q=U[1];F.fullScrollTop=F.fullScrollTop-W+this.scrollTop,F.fullScrollLeft=F.fullScrollLeft-q+this.scrollLeft,F.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(R,D),R.addEventListener("scroll",D)}R=R.parentElement}}deregisterScrollOffsets(){for(const R of this.scrollCallbackMap.keys())R.removeEventListener("scroll",this.scrollCallbackMap.get(R));this.scrollCallbackMap.clear()}initialize(){this.fullOffsetLeft=0,this.fullOffsetTop=0;let R=this.osmdSheetMusicContainer;const F=[],D=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(G=>{WebDisplayInteractionManager.resizeCallback(G,D)}));R;)this.fullOffsetLeft+=R.offsetLeft,this.fullOffsetTop+=R.offsetTop,this.resizeObserver?this.resizeObserver.observe(R):F.push(R),R=R.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{D.resizeObserver.disconnect(),D.resizeObserver=void 0};else{let G=()=>{WebDisplayInteractionManager.resizeCallback(F,D)};window.addEventListener("resize",G),this.disposeResizeListener=()=>{window.removeEventListener("resize",G),G=void 0}}D.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const R of this.EventCallbackMap.keys()){const F=this.EventCallbackMap.getValue(R);F[0].removeEventListener(R,F[1])}this.EventCallbackMap.clear(),this.deregisterScrollOffsets(),this.scrollCallbackMap.clear(),this.parentScrollMap.clear()}isTouch(){if("ontouchstart"in window||window.DocumentTouch)return!0;if(!window.matchMedia)return!1;const F=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(F).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const R=this.downEventListener.bind(this),F=this.touchEndEventListener.bind(this),D=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",R),this.osmdSheetMusicContainer.addEventListener("touchend",F),document.addEventListener(this.moveEventName,D),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,R]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,F]),this.EventCallbackMap.setValue(this.moveEventName,[document,D])}downEventListener(R){const F=new Date().getTime(),D=F-this.lastClick;clearTimeout(this.clickTimeout);let G=0,U=0;this.isTouch()&&R instanceof TouchEvent?(G=R.touches[0].pageX,U=R.touches[0].pageY):R instanceof MouseEvent&&(G=R.pageX,U=R.pageY);const W=this.getOffsetCoordinates(G,U);if(D0)this.doubleClick(W.x,W.y);else{const q=this;this.clickTimeout=setTimeout(function(){clearTimeout(this.clickTimeout),q.isTouch()?q.touchDown(W.x,W.y,void 0):q.click(W.x,W.y)},this.DOUBLE_CLICK_WINDOW)}this.lastClick=F}moveEventListener(R){let F=0,D=0;if(this.isTouch()&&R instanceof TouchEvent){let U;R.touches&&R.touches.length>0?U=R.touches[0]:R.changedTouches&&R.changedTouches.length>0&&(U=R.changedTouches[0]),F=U==null?void 0:U.clientX,D=U==null?void 0:U.clientY}else R instanceof MouseEvent&&(F=R.clientX,D=R.clientY);const G=this.getOffsetCoordinates(F,D);this.move(G.x,G.y)}touchEndEventListener(R){let F;R.touches&&R.touches.length>0?F=R.touches[0]:R.changedTouches&&R.changedTouches.length>0&&(F=R.changedTouches[0]);const D=this.getOffsetCoordinates(F==null?void 0:F.pageX,F==null?void 0:F.pageY);this.touchUp(D.x,D.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(R,F){const D=R-this.fullOffsetLeft+this.fullScrollLeft,G=F-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(D,G)}}class DynamicsCalculator{static fillDynamicsList(R,F,D){for(let G=0;G=0&&D[Y].push(new DynamicsContainer(q.InstantaneousDynamic,Y))}if(q.StartingContinuousDynamic!==void 0){D[G].push(new DynamicsContainer(q.StartingContinuousDynamic,q.StaffNumber));const Y=this.getOtherStaffIndexIfLinkedStavesAreDetected(R,G,q.StartingContinuousDynamic.Placement);Y>=0&&D[Y].push(new DynamicsContainer(q.StartingContinuousDynamic,Y))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(R,F,D){const G=R.getStaffFromIndex(F),U=G.ParentInstrument.Staves.indexOf(G),W=G.ParentInstrument.Staves.length;return W>1&&U===0&&D===PlacementEnum.Below?F+1:W>1&&U===1&&D===PlacementEnum.Above?F-1:-1}static fillDynamicExpressions(R){const F=R.DynListStaves,D=R.getCompleteNumberOfStaves(),G=R.TimestampSortedDynamicExpressionsList;for(let U=0;U{R(this.processStringXml(D))},D=>{log$2.error(new Error("[OSMD] Invalid MXL file: "+D)),F(new Error("[OSMD] Invalid MXL file: "+D))})}processStringXml(B){const R=new DOMParser;if(B.substr(0,3)==="\uF7EF\uF7BB\uF7BF")return log$2.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+B),R.parseFromString(B.substr(3),"application/xml");if(B.substr(0,6).includes("{F.isMxl(j)?F.processMxl(j,q,Y):q(F.processStringXml(j))},j=>{throw Y(j),j});else{const j=new Error("[OSMD] osmd.load(string): Could not process string. Did not find {R.init(this.sheet.MusicPartManager,this.graphic)}),this.renderingManager.setMusicSheet(this.graphic),this.interactionManager.Initialize()}render(){var R;if(!this.graphic)throw new Error("OpenSheetMusicDisplay: Before rendering a music sheet, please load a MusicXML file");(R=this.drawer)==null||R.clear();let B=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(B=this.rules.SheetMaximumWidth),this.sheet.pageWidth=B/this.zoom/10,this.renderingManager.MainViewingRegion.WidthInUnits=this.sheet.pageWidth,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,log$2.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(log$2.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(F=>{F.update()}),this.zoomUpdated=!1,this.interactionManager.displaySizeChanged(this.container.clientWidth,this.container.clientHeight)}createOrRefreshRenderBackend(){this.drawer&&this.drawer.Backends&&(this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container),this.drawer.Backends.clear()),this.drawingParameters.Rules=this.rules,this.drawer=new VexFlowMusicSheetDrawer(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let B=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(B=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let R;const F=32767;for(const D of this.graphic.MusicPages){if(D.PageNumber>this.rules.MaxPageToDrawNumber)break;const G=this.createBackend(this.backendType,D),U=" exceeds CanvasBackend limit of 32767. Cutting off score.";G.getOSMDBackendType()===BackendType.Canvas&&B>F&&(log$2.warn("[OSMD] Warning: width of "+B+U),B=F),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?R=B/this.rules.PageFormat.aspectRatio:(R=D.PositionAndShape.Size.height,R+=this.rules.PageBottomMargin,R+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(R+=this.rules.TitleTopDistance),R*=this.zoom*10),G.getOSMDBackendType()===BackendType.Canvas&&R>F&&(log$2.warn("[OSMD] Warning: height of "+R+U),R=Math.min(R,F)),G.resize(B,R),G.clear(),this.drawer.Backends.push(G),this.graphic.drawer=this.drawer}}exportSVG(){var B;for(const R of(B=this.drawer)==null?void 0:B.Backends)R instanceof SvgVexFlowBackend&&R.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var B;(B=this.drawer)==null||B.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(B){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),B==null){log$2.warn(`warning: osmd.setOptions() called without an options parameter, has no effect. example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);return}this.OnXMLRead=function(G){return G},B.onXMLRead&&(this.OnXMLRead=B.onXMLRead),B.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[B.drawingParameters.toLowerCase()]);let F=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(B.backend!==void 0){const G=OSMDOptions.BackendTypeFromString(B.backend);F=F||this.backendType!==G,this.backendType=G}this.needBackendUpdate=F,B.autoBeam!==void 0&&(this.rules.AutoBeamNotes=B.autoBeam);const D=B.autoBeamOptions;if(D&&(D.maintain_stem_directions===void 0&&(D.maintain_stem_directions=!1),this.rules.AutoBeamOptions=D,D.groups&&D.groups.length)){for(const G of D.groups)if(G.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}B.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=B.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&B.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=B.percussionForceVoicesOneLineCutoff),B.alignRests!==void 0&&(this.rules.AlignRests=B.alignRests),B.coloringMode!==void 0&&this.setColoringMode(B),B.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=B.coloringEnabled),B.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=B.colorStemsLikeNoteheads),B.disableCursor&&(this.drawingParameters.drawCursors=!1),B.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),B.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=B.drawCredits),B.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=B.drawComposer),B.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=B.drawTitle),B.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=B.drawSubtitle),B.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=B.drawLyricist),B.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=B.drawMetronomeMarks),B.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=B.drawPartNames,B.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=B.drawPartNames)),B.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=B.drawPartAbbreviations),B.drawFingerings===!1&&(this.rules.RenderFingerings=!1),B.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=B.drawMeasureNumbers),B.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=B.drawMeasureNumbersOnlyAtSystemStart),B.drawLyrics!==void 0&&(this.rules.RenderLyrics=B.drawLyrics),B.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=B.drawTimeSignatures),B.drawSlurs!==void 0&&(this.rules.RenderSlurs=B.drawSlurs),B.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=B.measureNumberInterval),B.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=B.useXMLMeasureNumbers),B.fingeringPosition!==void 0&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(B.fingeringPosition)),B.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=B.fingeringInsideStafflines),B.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=B.newSystemFromXML),B.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=B.newPageFromXML),B.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=B.fillEmptyMeasuresWithWholeRest),B.followCursor!==void 0&&(this.FollowCursor=B.followCursor),B.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=B.setWantedStemDirectionByXml),B.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):B.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),B.defaultColorMusic&&this.rules.applyDefaultColorMusic(B.defaultColorMusic),B.defaultColorNotehead&&(this.rules.DefaultColorNotehead=B.defaultColorNotehead),B.defaultColorRest&&(this.rules.DefaultColorRest=B.defaultColorRest),B.defaultColorStem&&(this.rules.DefaultColorStem=B.defaultColorStem),B.defaultColorLabel&&(this.rules.DefaultColorLabel=B.defaultColorLabel),B.defaultColorTitle&&(this.rules.DefaultColorTitle=B.defaultColorTitle),B.defaultFontFamily&&(this.rules.DefaultFontFamily=B.defaultFontFamily),B.defaultFontStyle&&(this.rules.DefaultFontStyle=B.defaultFontStyle),B.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=B.drawUpToMeasureNumber-1),B.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=B.drawFromMeasureNumber-1),B.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=B.drawUpToPageNumber),B.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=B.drawUpToSystemNumber),B.tupletsRatioed&&(this.rules.TupletsRatioed=!0),B.tupletsBracketed&&(this.rules.TupletsBracketed=!0),B.tripletsBracketed&&(this.rules.TripletsBracketed=!0),B.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):B.autoResize===!1&&(this.autoResizeEnabled=!1),B.pageFormat!==void 0&&this.setPageFormat(B.pageFormat),B.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=B.pageBackgroundColor),B.performanceMode!==void 0&&(this.rules.PerformanceMode=B.performanceMode),B.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=B.renderSingleHorizontalStaffline),B.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=B.spacingFactorSoftmax),B.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=B.spacingBetweenTextLines),B.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=B.stretchLastSystemLine),B.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=B.autoGenerateMutipleRestMeasuresFromRestMeasures),B.cursorsOptions!==void 0?this.cursorsOptions=B.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(B){if(B.coloringMode===ColoringModes.XML){this.rules.ColoringMode=ColoringModes.XML;return}const R=[NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B,-1];let F;if(B.coloringMode===ColoringModes.CustomColorSet){if(!B.coloringSetCustom||B.coloringSetCustom.length!==8)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter with 8 strings (C to B, rest note).");for(const G of B.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(G))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color: `+G);F=B.coloringSetCustom}else if(B.coloringMode===ColoringModes.AutoColoring){F=[];const G=Object.keys(AutoColorSet);for(let U=0;U{B.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const B=this;this.handleResize(()=>{},()=>{var R;((R=this.graphic)==null?void 0:R.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),B.IsReadyToRender()&&B.render()})}handleResize(B,R){let F,D;const U=this;function W(){!U.AutoResizeEnabled||(F=new Date().getTime(),D||(B(),F=new Date().getTime(),D=window.setTimeout(q,200)))}function q(){D=void 0,window.clearTimeout(D),new Date().getTime()-F<200?D=window.setTimeout(q,200):R()}window.attachEvent?window.attachEvent("onresize",W):window.addEventListener("resize",W),this.disposeResizeListener=()=>{window.detachEvent?window.detachEvent("onresize",W):window.removeEventListener("resize",W),this.resizeHandlerAttached=!1},this.resizeHandlerAttached=!0,window.setTimeout(B,0),window.setTimeout(R,1)}enableOrDisableCursors(B){var R,F,D,G,U,W;if(this.drawingParameters.drawCursors=B,B){for(let q=0;q{q.hide()})}createBackend(B,R){let F;return B===void 0||B===BackendType.SVG?F=new SvgVexFlowBackend(this.rules):F=new CanvasVexFlowBackend(this.rules),F.graphicalMusicPage=R,F.initialize(this.container,this.zoom),F.getContext().setFillStyle(this.rules.DefaultColorMusic),F.getContext().setStrokeStyle(this.rules.DefaultColorMusic),F}static StringToPageFormat(B){let R=PageFormat.UndefinedPageFormat;if(B.match("^[0-9]+x[0-9]+$")){const F=B.split("x"),D=Number.parseInt(F[0],10),G=Number.parseInt(F[1],10);D>0&&D<32768&&G>0&&G<32768&&(R=new PageFormat(D,G,`customPageFormat${B}`))}return B=B.replace(" ","_"),B=B.replace("Landscape","L"),B=B.replace("Portrait","P"),_OpenSheetMusicDisplay.PageFormatStandards.hasOwnProperty(B)&&(R=_OpenSheetMusicDisplay.PageFormatStandards[B]),R}setPageFormat(B){const R=_OpenSheetMusicDisplay.StringToPageFormat(B);this.needBackendUpdate=!R.Equals(this.rules.PageFormat),this.rules.PageFormat=R}setCustomPageFormat(B,R){if(B>0&&R>0){const F=new PageFormat(B,R);this.rules.PageFormat=F}}set DrawSkyLine(B){this.drawSkyLine=B,this.drawer&&(this.drawer.skyLineVisible=B)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(B){this.drawBottomLine=B,this.drawer&&(this.drawer.bottomLineVisible=B)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(B){this.setDrawBoundingBox(B,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(B,R=!1){this.drawBoundingBox=B,this.drawer&&(this.drawer.drawableBoundingBoxElement=B),R&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(B){this.autoResizeEnabled=B}get Zoom(){return this.zoom}set Zoom(B){var R;this.zoom=B,this.zoomUpdated=!0,((R=this.graphic)==null?void 0:R.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(B){this.followCursor=B}get FollowCursor(){return this.followCursor}set TransposeCalculator(B){MusicSheetCalculator.transposeCalculator=B}get TransposeCalculator(){return MusicSheetCalculator.transposeCalculator}get Sheet(){return this.sheet}get Drawer(){return this.drawer}get GraphicSheet(){return this.graphic}get DrawingParameters(){return this.drawingParameters}get EngravingRules(){return this.rules}get InteractionManager(){return this.interactionManager}get Version(){return this.version}};let OpenSheetMusicDisplay=_OpenSheetMusicDisplay;OpenSheetMusicDisplay.PageFormatStandards={A3_L:new PageFormat(420,297,"A3_L"),A3_P:new PageFormat(297,420,"A3_P"),A4_L:new PageFormat(297,210,"A4_L"),A4_P:new PageFormat(210,297,"A4_P"),A5_L:new PageFormat(210,148,"A5_L"),A5_P:new PageFormat(148,210,"A5_P"),A6_L:new PageFormat(148,105,"A6_L"),A6_P:new PageFormat(105,148,"A6_P"),Endless:PageFormat.UndefinedPageFormat,Letter_L:new PageFormat(279.4,215.9,"Letter_L"),Letter_P:new PageFormat(215.9,279.4,"Letter_P")};var handlebars={exports:{}},handlebars_runtime={exports:{}},base$1={},utils={};utils.__esModule=!0;utils.extend=extend;utils.indexOf=indexOf;utils.escapeExpression=escapeExpression;utils.isEmpty=isEmpty;utils.createFrame=createFrame;utils.blockParams=blockParams;utils.appendContextPath=appendContextPath;var escape$1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},badChars=/[&<>"'`=]/g,possible=/[&<>"'`=]/;function escapeChar(B){return escape$1[B]}function extend(B){for(var R=1;R0?(U.ids&&(U.ids=[U.name]),D.helpers.each(G,U)):W(this);if(U.data&&U.ids){var Y=F.createFrame(U.data);Y.contextPath=F.appendContextPath(U.data.contextPath,U.name),U={data:Y}}return q(G,U)})},B.exports=R.default})(blockHelperMissing,blockHelperMissing.exports);var each={exports:{}};(function(B,R){R.__esModule=!0;function F(W){return W&&W.__esModule?W:{default:W}}var D=utils,G=exception.exports,U=F(G);R.default=function(W){W.registerHelper("each",function(q,Y){if(!Y)throw new U.default("Must pass iterator to #each");var K=Y.fn,Z=Y.inverse,j=0,Q="",J=void 0,te=void 0;Y.data&&Y.ids&&(te=D.appendContextPath(Y.data.contextPath,Y.ids[0])+"."),D.isFunction(q)&&(q=q.call(this)),Y.data&&(J=D.createFrame(Y.data));function ne(fe,he,ge){J&&(J.key=fe,J.index=he,J.first=he===0,J.last=!!ge,te&&(J.contextPath=te+fe)),Q=Q+K(q[fe],{data:J,blockParams:D.blockParams([q[fe],fe],[te+fe,null])})}if(q&&typeof q=="object")if(D.isArray(q))for(var ie=q.length;j=0?U=W:U=parseInt(U,10)}return U},log:function(U){if(U=D.lookupLevel(U),typeof console!="undefined"&&D.lookupLevel(D.level)<=U){var W=D.methodMap[U];console[W]||(W="log");for(var q=arguments.length,Y=Array(q>1?q-1:0),K=1;K= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};base$1.REVISION_CHANGES=REVISION_CHANGES;var objectType="[object Object]";function HandlebarsEnvironment(B,R,F){this.helpers=B||{},this.partials=R||{},this.decorators=F||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function(R,F){if(_utils$3.toString.call(R)===objectType){if(F)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,R)}else this.helpers[R]=F},unregisterHelper:function(R){delete this.helpers[R]},registerPartial:function(R,F){if(_utils$3.toString.call(R)===objectType)_utils$3.extend(this.partials,R);else{if(typeof F=="undefined")throw new _exception2$3.default('Attempting to register a partial called "'+R+'" as undefined');this.partials[R]=F}},unregisterPartial:function(R){delete this.partials[R]},registerDecorator:function(R,F){if(_utils$3.toString.call(R)===objectType){if(F)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,R)}else this.decorators[R]=F},unregisterDecorator:function(R){delete this.decorators[R]},resetLoggedPropertyAccesses:function(){_internalProtoAccess$1.resetLoggedProperties()}};var log=_logger2.default.log;base$1.log=log;base$1.createFrame=_utils$3.createFrame;base$1.logger=_logger2.default;var safeString={exports:{}};(function(B,R){R.__esModule=!0;function F(D){this.string=D}F.prototype.toString=F.prototype.toHTML=function(){return""+this.string},R.default=F,B.exports=R.default})(safeString,safeString.exports);var runtime={},wrapHelper$1={};wrapHelper$1.__esModule=!0;wrapHelper$1.wrapHelper=wrapHelper;function wrapHelper(B,R){if(typeof B!="function")return B;var F=function(){var G=arguments[arguments.length-1];return arguments[arguments.length-1]=R(G),B.apply(this,arguments)};return F}runtime.__esModule=!0;runtime.checkRevision=checkRevision;runtime.template=template;runtime.wrapProgram=wrapProgram;runtime.resolvePartial=resolvePartial;runtime.invokePartial=invokePartial;runtime.noop=noop$1;function _interopRequireDefault$3(B){return B&&B.__esModule?B:{default:B}}function _interopRequireWildcard$1(B){if(B&&B.__esModule)return B;var R={};if(B!=null)for(var F in B)Object.prototype.hasOwnProperty.call(B,F)&&(R[F]=B[F]);return R.default=B,R}var _utils$2=utils,Utils=_interopRequireWildcard$1(_utils$2),_exception$2=exception.exports,_exception2$2=_interopRequireDefault$3(_exception$2),_base=base$1,_helpers$1=helpers$1,_internalWrapHelper=wrapHelper$1,_internalProtoAccess=protoAccess;function checkRevision(B){var R=B&&B[0]||1,F=_base.COMPILER_REVISION;if(!(R>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&R<=_base.COMPILER_REVISION))if(R<_base.LAST_COMPATIBLE_COMPILER_REVISION){var D=_base.REVISION_CHANGES[F],G=_base.REVISION_CHANGES[R];throw new _exception2$2.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+D+") or downgrade your runtime to an older version ("+G+").")}else throw new _exception2$2.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+B[1]+").")}function template(B,R){if(!R)throw new _exception2$2.default("No environment passed to template");if(!B||!B.main)throw new _exception2$2.default("Unknown template object: "+typeof B);B.main.decorator=B.main_d,R.VM.checkRevision(B.compiler);var F=B.compiler&&B.compiler[0]===7;function D(W,q,Y){Y.hash&&(q=Utils.extend({},q,Y.hash),Y.ids&&(Y.ids[0]=!0)),W=R.VM.resolvePartial.call(this,W,q,Y);var K=Utils.extend({},Y,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),Z=R.VM.invokePartial.call(this,W,q,K);if(Z==null&&R.compile&&(Y.partials[Y.name]=R.compile(W,B.compilerOptions,R),Z=Y.partials[Y.name](q,K)),Z!=null){if(Y.indent){for(var j=Z.split(` `),Q=0,J=j.length;Q2&&pe.push("'"+this.terminals_[me]+"'");this.lexer.showPosition?be="Parse error on line "+(te+1)+`: `+this.lexer.showPosition()+` Expecting `+pe.join(", ")+", got '"+(this.terminals_[le]||le)+"'":be="Parse error on line "+(te+1)+": Unexpected "+(le==1?"end of input":"'"+(this.terminals_[le]||le)+"'"),this.parseError(be,{text:this.lexer.match,token:this.terminals_[le]||le,line:this.lexer.yylineno,loc:ie,expected:pe})}}if(he[0]instanceof Array&&he.length>1)throw new Error("Parse Error: multiple actions possible at state: "+fe+", token: "+le);switch(he[0]){case 1:K.push(le),Z.push(this.lexer.yytext),j.push(this.lexer.yylloc),K.push(he[1]),le=null,ne=this.lexer.yyleng,J=this.lexer.yytext,te=this.lexer.yylineno,ie=this.lexer.yylloc;break;case 2:if(ye=this.productions_[he[1]][1],ce.$=Z[Z.length-ye],ce._$={first_line:j[j.length-(ye||1)].first_line,last_line:j[j.length-1].last_line,first_column:j[j.length-(ye||1)].first_column,last_column:j[j.length-1].last_column},re&&(ce._$.range=[j[j.length-(ye||1)].range[0],j[j.length-1].range[1]]),ge=this.performAction.call(ce,J,ne,te,this.yy,he[1],Z,j),typeof ge!="undefined")return ge;ye&&(K=K.slice(0,-1*ye*2),Z=Z.slice(0,-1*ye),j=j.slice(0,-1*ye)),K.push(this.productions_[he[1]][0]),Z.push(ce.$),j.push(ce._$),ve=Q[K[K.length-2]][K[K.length-1]],K.push(ve);break;case 3:return!0}}return!0}},G=function(){var W={EOF:1,parseError:function(Y,K){if(this.yy.parser)this.yy.parser.parseError(Y,K);else throw new Error(Y)},setInput:function(Y){return this._input=Y,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var Y=this._input[0];this.yytext+=Y,this.yyleng++,this.offset++,this.match+=Y,this.matched+=Y;var K=Y.match(/(?:\r\n?|\n).*/g);return K?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Y},unput:function(Y){var K=Y.length,Z=Y.split(/(?:\r\n?|\n)/g);this._input=Y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-K-1),this.offset-=K;var j=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Z.length-1&&(this.yylineno-=Z.length-1);var Q=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Z?(Z.length===j.length?this.yylloc.first_column:0)+j[j.length-Z.length].length-Z[0].length:this.yylloc.first_column-K},this.options.ranges&&(this.yylloc.range=[Q[0],Q[0]+this.yyleng-K]),this},more:function(){return this._more=!0,this},less:function(Y){this.unput(this.match.slice(Y))},pastInput:function(){var Y=this.matched.substr(0,this.matched.length-this.match.length);return(Y.length>20?"...":"")+Y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var Y=this.match;return Y.length<20&&(Y+=this._input.substr(0,20-Y.length)),(Y.substr(0,20)+(Y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var Y=this.pastInput(),K=new Array(Y.length+1).join("-");return Y+this.upcomingInput()+` `+K+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Y,K,Z,j,Q;this._more||(this.yytext="",this.match="");for(var J=this._currentRules(),te=0;teK[0].length)&&(K=Z,j=te,!this.options.flex)));te++);return K?(Q=K[0].match(/(?:\r\n?|\n).*/g),Q&&(this.yylineno+=Q.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Q?Q[Q.length-1].length-Q[Q.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+K[0].length},this.yytext+=K[0],this.match+=K[0],this.matches=K,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(K[0].length),this.matched+=K[0],Y=this.performAction.call(this,this.yy,this,J[j],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Y||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var Y=this.next();return typeof Y!="undefined"?Y:this.lex()},begin:function(Y){this.conditionStack.push(Y)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(Y){this.begin(Y)}};return W.options={},W.performAction=function(Y,K,Z,j){function Q(J,te){return K.yytext=K.yytext.substring(J,K.yyleng-te+J)}switch(Z){case 0:if(K.yytext.slice(-2)==="\\\\"?(Q(0,1),this.begin("mu")):K.yytext.slice(-1)==="\\"?(Q(0,1),this.begin("emu")):this.begin("mu"),K.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(Q(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(K.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return K.yytext=Q(1,2).replace(/\\"/g,'"'),80;case 32:return K.yytext=Q(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return K.yytext=K.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},W.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],W.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},W}();D.lexer=G;function U(){this.yy={}}return U.prototype=D,D.Parser=U,new U}();R.default=F,B.exports=R.default})(parser$2,parser$2.exports);var whitespaceControl={exports:{}},visitor={exports:{}};(function(B,R){R.__esModule=!0;function F(K){return K&&K.__esModule?K:{default:K}}var D=exception.exports,G=F(D);function U(){this.parents=[]}U.prototype={constructor:U,mutating:!1,acceptKey:function(Z,j){var Q=this.accept(Z[j]);if(this.mutating){if(Q&&!U.prototype[Q.type])throw new G.default('Unexpected node type "'+Q.type+'" found when accepting '+j+" on "+Z.type);Z[j]=Q}},acceptRequired:function(Z,j){if(this.acceptKey(Z,j),!Z[j])throw new G.default(Z.type+" requires "+j)},acceptArray:function(Z){for(var j=0,Q=Z.length;j0)throw new _exception2$1.default("Invalid path: "+D,{loc:F});Y===".."&&U++}else G.push(Y)}return{type:"PathExpression",data:B,depth:U,parts:G,original:D,loc:F}}function prepareMustache(B,R,F,D,G,U){var W=D.charAt(3)||D.charAt(2),q=W!=="{"&&W!=="&",Y=/\*/.test(D);return{type:Y?"Decorator":"MustacheStatement",path:B,params:R,hash:F,escaped:q,strip:G,loc:this.locInfo(U)}}function prepareRawBlock(B,R,F,D){validateClose(B,F),D=this.locInfo(D);var G={type:"Program",body:R,strip:{},loc:D};return{type:"BlockStatement",path:B.path,params:B.params,hash:B.hash,program:G,openStrip:{},inverseStrip:{},closeStrip:{},loc:D}}function prepareBlock(B,R,F,D,G,U){D&&D.path&&validateClose(B,D);var W=/\*/.test(B.open);R.blockParams=B.blockParams;var q=void 0,Y=void 0;if(F){if(W)throw new _exception2$1.default("Unexpected inverse block on decorator",F);F.chain&&(F.program.body[0].closeStrip=D.strip),Y=F.strip,q=F.program}return G&&(G=q,q=R,R=G),{type:W?"DecoratorBlock":"BlockStatement",path:B.path,params:B.params,hash:B.hash,program:R,inverse:q,openStrip:B.strip,inverseStrip:Y,closeStrip:D&&D.strip,loc:this.locInfo(U)}}function prepareProgram(B,R){if(!R&&B.length){var F=B[0].loc,D=B[B.length-1].loc;F&&D&&(R={source:F.source,start:{line:F.start.line,column:F.start.column},end:{line:D.end.line,column:D.end.column}})}return{type:"Program",body:B,strip:{},loc:R}}function preparePartialBlock(B,R,F,D){return validateClose(B,F),{type:"PartialBlockStatement",name:B.path,params:B.params,hash:B.hash,program:R,openStrip:B.strip,closeStrip:F&&F.strip,loc:this.locInfo(D)}}base.__esModule=!0;base.parseWithoutProcessing=parseWithoutProcessing;base.parse=parse$2;function _interopRequireWildcard(B){if(B&&B.__esModule)return B;var R={};if(B!=null)for(var F in B)Object.prototype.hasOwnProperty.call(B,F)&&(R[F]=B[F]);return R.default=B,R}function _interopRequireDefault$1(B){return B&&B.__esModule?B:{default:B}}var _parser=parser$2.exports,_parser2=_interopRequireDefault$1(_parser),_whitespaceControl=whitespaceControl.exports,_whitespaceControl2=_interopRequireDefault$1(_whitespaceControl),_helpers=helpers,Helpers=_interopRequireWildcard(_helpers),_utils$1=utils;base.parser=_parser2.default;var yy={};_utils$1.extend(yy,Helpers);function parseWithoutProcessing(B,R){if(B.type==="Program")return B;_parser2.default.yy=yy,yy.locInfo=function(D){return new yy.SourceLocation(R&&R.srcName,D)};var F=_parser2.default.parse(B);return F}function parse$2(B,R){var F=parseWithoutProcessing(B,R),D=new _whitespaceControl2.default(R);return D.accept(F)}var compiler={};compiler.__esModule=!0;compiler.Compiler=Compiler;compiler.precompile=precompile;compiler.compile=compile;function _interopRequireDefault(B){return B&&B.__esModule?B:{default:B}}var _exception=exception.exports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=ast.exports,_ast2=_interopRequireDefault(_ast),slice=[].slice;function Compiler(){}Compiler.prototype={compiler:Compiler,equals:function(R){var F=this.opcodes.length;if(R.opcodes.length!==F)return!1;for(var D=0;D1)throw new _exception2.default("Unsupported number of partial arguments: "+D.length,R);D.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):D.push({type:"PathExpression",parts:[],depth:0}));var G=R.name.original,U=R.name.type==="SubExpression";U&&this.accept(R.name),this.setupFullMustacheParams(R,F,void 0,!0);var W=R.indent||"";this.options.preventIndent&&W&&(this.opcode("appendContent",W),W=""),this.opcode("invokePartial",U,G,W),this.opcode("append")},PartialBlockStatement:function(R){this.PartialStatement(R)},MustacheStatement:function(R){this.SubExpression(R),R.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(R){this.DecoratorBlock(R)},ContentStatement:function(R){R.value&&this.opcode("appendContent",R.value)},CommentStatement:function(){},SubExpression:function(R){transformLiteralToPath(R);var F=this.classifySexpr(R);F==="simple"?this.simpleSexpr(R):F==="helper"?this.helperSexpr(R):this.ambiguousSexpr(R)},ambiguousSexpr:function(R,F,D){var G=R.path,U=G.parts[0],W=F!=null||D!=null;this.opcode("getContext",G.depth),this.opcode("pushProgram",F),this.opcode("pushProgram",D),G.strict=!0,this.accept(G),this.opcode("invokeAmbiguous",U,W)},simpleSexpr:function(R){var F=R.path;F.strict=!0,this.accept(F),this.opcode("resolvePossibleLambda")},helperSexpr:function(R,F,D){var G=this.setupFullMustacheParams(R,F,D),U=R.path,W=U.parts[0];if(this.options.knownHelpers[W])this.opcode("invokeKnownHelper",G.length,W);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+W,R);U.strict=!0,U.falsy=!0,this.accept(U),this.opcode("invokeHelper",G.length,U.original,_ast2.default.helpers.simpleId(U))}},PathExpression:function(R){this.addDepth(R.depth),this.opcode("getContext",R.depth);var F=R.parts[0],D=_ast2.default.helpers.scopedId(R),G=!R.depth&&!D&&this.blockParamIndex(F);G?this.opcode("lookupBlockParam",G,R.parts):F?R.data?(this.options.data=!0,this.opcode("lookupData",R.depth,R.parts,R.strict)):this.opcode("lookupOnContext",R.parts,R.falsy,R.strict,D):this.opcode("pushContext")},StringLiteral:function(R){this.opcode("pushString",R.value)},NumberLiteral:function(R){this.opcode("pushLiteral",R.value)},BooleanLiteral:function(R){this.opcode("pushLiteral",R.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(R){var F=R.pairs,D=0,G=F.length;for(this.opcode("pushHash");D=0)return[F,U]}}};function precompile(B,R,F){if(B==null||typeof B!="string"&&B.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+B);R=R||{},"data"in R||(R.data=!0),R.compat&&(R.useDepths=!0);var D=F.parse(B,R),G=new F.Compiler().compile(D,R);return new F.JavaScriptCompiler().compile(G,R)}function compile(B,R,F){if(R===void 0&&(R={}),B==null||typeof B!="string"&&B.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+B);R=_utils.extend({},R),"data"in R||(R.data=!0),R.compat&&(R.useDepths=!0);var D=void 0;function G(){var W=F.parse(B,R),q=new F.Compiler().compile(W,R),Y=new F.JavaScriptCompiler().compile(q,R,void 0,!0);return F.template(Y)}function U(W,q){return D||(D=G()),D.call(this,W,q)}return U._setup=function(W){return D||(D=G()),D._setup(W)},U._child=function(W,q,Y,K){return D||(D=G()),D._child(W,q,Y,K)},U}function argEquals(B,R){if(B===R)return!0;if(_utils.isArray(B)&&_utils.isArray(R)&&B.length===R.length){for(var F=0;F0&&(ne+=", "+ie.join(", "));var re=0;Object.keys(this.aliases).forEach(function(fe){var he=te.aliases[fe];he.children&&he.referenceCount>1&&(ne+=", alias"+ ++re+"="+fe,he.children[0]="alias"+re)}),this.lookupPropertyFunctionIsUsed&&(ne+=", "+this.lookupPropertyFunctionVarDeclaration());var oe=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&oe.push("blockParams"),this.useDepths&&oe.push("depths");var le=this.mergeSource(ne);return J?(oe.push(le),Function.apply(this,oe)):this.source.wrap(["function(",oe.join(","),`) { `,le,"}"])},mergeSource:function(J){var te=this.environment.isSimple,ne=!this.forceBuffer,ie=void 0,re=void 0,oe=void 0,le=void 0;return this.source.each(function(fe){fe.appendToBuffer?(oe?fe.prepend(" + "):oe=fe,le=fe):(oe&&(re?oe.prepend("buffer += "):ie=!0,le.add(";"),oe=le=void 0),re=!0,te||(ne=!1))}),ne?oe?(oe.prepend("return "),le.add(";")):re||this.source.push('return "";'):(J+=", buffer = "+(ie?"":this.initializeBuffer()),oe?(oe.prepend("return buffer + "),le.add(";")):this.source.push("return buffer;")),J&&this.source.prepend("var "+J.substring(2)+(ie?"":`; `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined } `.trim()},blockValue:function(J){var te=this.aliasable("container.hooks.blockHelperMissing"),ne=[this.contextName(0)];this.setupHelperArgs(J,0,ne);var ie=this.popStack();ne.splice(1,0,ie),this.push(this.source.functionCall(te,"call",ne))},ambiguousBlockValue:function(){var J=this.aliasable("container.hooks.blockHelperMissing"),te=[this.contextName(0)];this.setupHelperArgs("",0,te,!0),this.flushInline();var ne=this.topStack();te.splice(1,0,ne),this.pushSource(["if (!",this.lastHelper,") { ",ne," = ",this.source.functionCall(J,"call",te),"}"])},appendContent:function(J){this.pendingContent?J=this.pendingContent+J:this.pendingLocation=this.source.currentLocation,this.pendingContent=J},append:function(){if(this.isInline())this.replaceStack(function(te){return[" != null ? ",te,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var J=this.popStack();this.pushSource(["if (",J," != null) { ",this.appendToBuffer(J,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(J){this.lastContext=J},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(J,te,ne,ie){var re=0;!ie&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(J[re++])):this.pushContext(),this.resolvePath("context",J,re,te,ne)},lookupBlockParam:function(J,te){this.useBlockParams=!0,this.push(["blockParams[",J[0],"][",J[1],"]"]),this.resolvePath("context",te,1)},lookupData:function(J,te,ne){J?this.pushStackLiteral("container.data(data, "+J+")"):this.pushStackLiteral("data"),this.resolvePath("data",te,0,!0,ne)},resolvePath:function(J,te,ne,ie,re){var oe=this;if(this.options.strict||this.options.assumeObjects){this.push(j(this.options.strict&&re,this,te,J));return}for(var le=te.length;nethis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var J=this.inlineStack;this.inlineStack=[];for(var te=0,ne=J.length;teB!==null&&B.isSecureContext,createNativeAudioBufferConstructor=B=>B===null?null:B.hasOwnProperty("AudioBuffer")?B.AudioBuffer:null,createNativeAudioContextConstructor=B=>B===null?null:B.hasOwnProperty("AudioContext")?B.AudioContext:B.hasOwnProperty("webkitAudioContext")?B.webkitAudioContext:null,createNativeAudioWorkletNodeConstructor=B=>B===null?null:B.hasOwnProperty("AudioWorkletNode")?B.AudioWorkletNode:null,createNativeOfflineAudioContextConstructor=B=>B===null?null:B.hasOwnProperty("OfflineAudioContext")?B.OfflineAudioContext:B.hasOwnProperty("webkitOfflineAudioContext")?B.webkitOfflineAudioContext:null,createWindow=()=>typeof window=="undefined"?null:window,window$1=createWindow();createNativeOfflineAudioContextConstructor(window$1);createNativeAudioContextConstructor(window$1);createNativeAudioWorkletNodeConstructor(window$1);createNativeAudioBufferConstructor(window$1);createIsSecureContext(window$1);var lib$2={exports:{}},lib$1={exports:{}};function b64ToUint6(B){return B>64&&B<91?B-65:B>96&&B<123?B-71:B>47&&B<58?B+4:B===43?62:B===47?63:0}function decode(B,R){for(var F=B.replace(/[^A-Za-z0-9\+\/]/g,""),D=F.length,G=R?Math.ceil((D*3+1>>2)/R)*R:D*3+1>>2,U=new Uint8Array(G),W,q,Y=0,K=0,Z=0;Z>>(16>>>W&24)&255;Y=0}return U}var base64={decode},fetch$1=function(B,R){return new Promise(function(F,D){var G=new XMLHttpRequest;R&&(G.responseType=R),G.open("GET",B),G.onload=function(){G.status===200?F(G.response):D(Error(G.statusText))},G.onerror=function(){D(Error("Network Error"))},G.send()})};(function(B){var R=base64,F=fetch$1;function D(ce){return function(me){return typeof me=="string"&&ce.test(me)}}function G(ce,me){return typeof ce=="string"?ce+me:typeof ce=="function"?ce(me):me}function U(ce,me,ye,ve){var pe=W(me)?q:Y(me)?K:Z(me)?j:Q(me)?J:te(me)?ne:ie(me)?re:oe(me)?le:fe(me)?he:null,be=ye||{};return pe?pe(ce,me,be):ve?Promise.resolve(ve):Promise.reject("Source not valid ("+me+")")}U.fetch=F;function W(ce){return ce instanceof ArrayBuffer}function q(ce,me,ye){return new Promise(function(ve,pe){ce.decodeAudioData(me,function(be){ve(be)},function(){pe("Can't decode audio data ("+me.slice(0,30)+"...)")})})}var Y=D(/\.(mp3|wav|ogg)(\?.*)?$/i);function K(ce,me,ye){var ve=G(ye.from,me);return U(ce,U.fetch(ve,"arraybuffer"),ye)}function Z(ce){return ce&&typeof ce.then=="function"}function j(ce,me,ye){return me.then(function(ve){return U(ce,ve,ye)})}var Q=Array.isArray;function J(ce,me,ye){return Promise.all(me.map(function(ve){return U(ce,ve,ye,ve)}))}function te(ce){return ce&&typeof ce=="object"}function ne(ce,me,ye){var ve={},pe=Object.keys(me).map(function(be){if(ye.only&&ye.only.indexOf(be)===-1)return null;var xe=me[be];return U(ce,xe,ye,xe).then(function(ue){ve[be]=ue})});return Promise.all(pe).then(function(){return ve})}var ie=D(/\.json(\?.*)?$/i);function re(ce,me,ye){var ve=G(ye.from,me);return U(ce,U.fetch(ve,"text").then(JSON.parse),ye)}var oe=D(/^data:audio/);function le(ce,me,ye){var ve=me.indexOf(",");return U(ce,R.decode(me.slice(ve+1)).buffer,ye)}var fe=D(/\.js(\?.*)?$/i);function he(ce,me,ye){var ve=G(ye.from,me);return U(ce,U.fetch(ve,"text").then(ge),ye)}function ge(ce){var me=ce.indexOf("MIDI.Soundfont.");if(me<0)throw Error("Invalid MIDI.js Soundfont format");me=ce.indexOf("=",me)+2;var ye=ce.lastIndexOf(",");return JSON.parse(ce.slice(me,ye)+"}")}B.exports&&(B.exports=U),typeof window!="undefined"&&(window.loadAudio=U)})(lib$1);var lib={exports:{}},adsr=ADSR$1;function ADSR$1(B){var R=B.createGain(),F=R._voltage=getVoltage(B),D=scale(F),G=scale(F),U=scale(F);return R._startAmount=scale(G),R._endAmount=scale(U),R._multiplier=scale(D),R._multiplier.connect(R),R._startAmount.connect(R),R._endAmount.connect(R),R.value=D.gain,R.startValue=G.gain,R.endValue=U.gain,R.startValue.value=0,R.endValue.value=0,Object.defineProperties(R,props),R}var props={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(B){var R=this._multiplier.gain,F=this._startAmount.gain,D=this._endAmount.gain;this._voltage.start(B),this._decayFrom=this._decayFrom=B+this.attack,this._startedAt=B;var G=this.sustain;R.cancelScheduledValues(B),F.cancelScheduledValues(B),D.cancelScheduledValues(B),D.setValueAtTime(0,B),this.attack?(R.setValueAtTime(0,B),R.linearRampToValueAtTime(1,B+this.attack),F.setValueAtTime(1,B),F.linearRampToValueAtTime(0,B+this.attack)):(R.setValueAtTime(1,B),F.setValueAtTime(0,B)),this.decay&&R.setTargetAtTime(G,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(B,R){R&&(B=B-this.release);var F=B+this.release;if(this.release){var D=this._multiplier.gain,G=this._startAmount.gain,U=this._endAmount.gain;D.cancelScheduledValues(B),G.cancelScheduledValues(B),U.cancelScheduledValues(B);var W=getTimeConstant(this.release);if(this.attack&&B=R&&(K=R),K}var ADSR=adsr,EMPTY={},DEFAULTS={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function SamplePlayer(B,R,F){var D=!1,G=0,U={},W=B.createGain();W.gain.value=1;var q=Object.assign({},DEFAULTS,F),Y={context:B,out:W,opts:q};return R instanceof AudioBuffer?Y.buffer=R:Y.buffers=R,Y.start=function(j,Q,J){if(Y.buffer&&j!==null)return Y.start(null,j,Q);var te=j?Y.buffers[j]:Y.buffer;if(te){if(!D){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+j+" not found.");return}var ne=J||EMPTY;Q=Math.max(B.currentTime,Q||0),Y.emit("start",Q,j,ne);var ie=Z(j,te,ne);return ie.id=K(j,ie),ie.env.start(Q),ie.source.start(Q),Y.emit("started",Q,ie.id,ie),ne.duration&&ie.stop(Q+ne.duration),ie},Y.play=function(j,Q,J){return Y.start(j,Q,J)},Y.stop=function(j,Q){var J;return Q=Q||Object.keys(U),Q.map(function(te){return J=U[te],J?(J.stop(j),J.id):null})},Y.connect=function(j){return D=!0,W.connect(j),Y},Y.emit=function(j,Q,J,te){Y.onevent&&Y.onevent(j,Q,J,te);var ne=Y["on"+j];ne&&ne(Q,J,te)},Y;function K(j,Q){return Q.id=G++,U[Q.id]=Q,Q.source.onended=function(){var J=B.currentTime;Q.source.disconnect(),Q.env.disconnect(),Q.disconnect(),Y.emit("ended",J,Q.id,Q)},Q.id}function Z(j,Q,J){var te=B.createGain();return te.gain.value=0,te.connect(W),te.env=envelope(B,J,q),te.env.connect(te.gain),te.source=B.createBufferSource(),te.source.buffer=Q,te.source.connect(te),te.source.loop=J.loop||q.loop,te.source.playbackRate.value=centsToRate(J.cents||q.cents),te.source.loopStart=J.loopStart||q.loopStart,te.source.loopEnd=J.loopEnd||q.loopEnd,te.stop=function(ne){var ie=ne||B.currentTime;Y.emit("stop",ie,j);var re=te.env.stop(ie);te.source.stop(re)},te}}function isNum$1(B){return typeof B=="number"}var PARAMS=["attack","decay","sustain","release"];function envelope(B,R,F){var D=ADSR(B),G=R.adsr||F.adsr;return PARAMS.forEach(function(U,W){G?D[U]=G[W]:D[U]=R[U]||F[U]}),D.value.value=isNum$1(R.gain)?R.gain:isNum$1(F.gain)?F.gain:1,D}function centsToRate(B){return B?Math.pow(2,B/1200):1}var player$1=SamplePlayer,events=function(B){return B.on=function(R,F){if(arguments.length===1&&typeof R=="function")return B.on("event",R);var D="on"+R,G=B[D];return B[D]=G?chain(G,F):F,B},B};function chain(B,R){return function(F,D,G,U){B(F,D,G,U),R(F,D,G,U)}}var REGEX$1=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function regex$1(){return REGEX$1}var SEMITONES$1=[0,2,4,5,7,9,11];function parse$1(B,R,F){if(typeof B!="string")return null;var D=REGEX$1.exec(B);if(!D||!R&&D[4])return null;var G={letter:D[1].toUpperCase(),acc:D[2].replace(/x/g,"##")};return G.pc=G.letter+G.acc,G.step=(G.letter.charCodeAt(0)+3)%7,G.alt=G.acc[0]==="b"?-G.acc.length:G.acc.length,G.chroma=SEMITONES$1[G.step]+G.alt,D[3]&&(G.oct=+D[3],G.midi=G.chroma+12*(G.oct+1),G.freq=midiToFreq$1(G.midi,F)),R&&(G.tonicOf=D[4]),G}function midiToFreq$1(B,R){return Math.pow(2,(B-69)/12)*(R||440)}var parser$1={parse:parse$1,regex:regex$1,midiToFreq:midiToFreq$1},FNS=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];FNS.forEach(function(B){parser$1[B]=function(R){var F=parse$1(R);return F&&typeof F[B]!="undefined"?F[B]:null}});var noteParser$1=parser$1,note=noteParser$1,isMidi=function(B){return B!==null&&B!==[]&&B>=0&&B<129},toMidi=function(B){return isMidi(B)?+B:note.midi(B)},notes=function(B){if(B.buffers){var R=B.opts.map,F=typeof R=="function"?R:toMidi,D=function(U){return U?F(U)||U:null};B.buffers=mapBuffers(B.buffers,D);var G=B.start;B.start=function(U,W,q){var Y=D(U),K=Y%1;return K&&(Y=Math.floor(Y),q=Object.assign(q||{},{cents:Math.floor(K*100)})),G(Y,W,q)}}return B};function mapBuffers(B,R){return Object.keys(B).reduce(function(F,D){return F[R(D)]=B[D],F},{})}var isArr=Array.isArray,isObj=function(B){return B&&typeof B=="object"},OPTS={},scheduler=function(B){return B.schedule=function(R,F){var D=B.context.currentTime,G=R6?null:LETTERS.charAt(B)+accStr(R)+octStr(F)}function midi(B){if((isNum(B)||isStr(B))&&B>=0&&B<128)return+B;var R=parse(B);return R&&isDef(R.midi)?R.midi:null}function freq(B,R){var F=midi(B);return F===null?null:midiToFreq(F,R)}function letter(B){return(parse(B)||{}).letter}function acc(B){return(parse(B)||{}).acc}function pc(B){return(parse(B)||{}).pc}function step(B){return(parse(B)||{}).step}function alt(B){return(parse(B)||{}).alt}function chroma(B){return(parse(B)||{}).chroma}function oct(B){return(parse(B)||{}).oct}var noteParser=Object.freeze(Object.defineProperty({__proto__:null,regex,parse,build,midi,freq,letter,acc,pc,step,alt,chroma,oct},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(noteParser),parser=require$$0;function Soundfont(B,R){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof Soundfont))return new Soundfont(B);this.nameToUrl=R||Soundfont.nameToUrl,this.ctx=B,this.instruments={},this.promises=[]}Soundfont.prototype.onready=function(B){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(B)};Soundfont.prototype.instrument=function(B,R){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var F=this.ctx;if(B=B||"default",B in this.instruments)return this.instruments[B];var D={name:B,play:oscillatorPlayer(F,R)};if(this.instruments[B]=D,B!=="default"){var G=Soundfont.instrument(F,B,R).then(function(U){return D.play=U.play,D});this.promises.push(G),D.onready=function(U){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),G.then(U)}}else D.onready=function(U){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),U()};return D};function loadBuffers(B,R,F){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),Soundfont.instrument(B,R,F).then(function(D){return D.buffers})}Soundfont.loadBuffers=loadBuffers;function oscillatorPlayer(B,R){return R=R||{},function(F,D,G,U){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var W=F>0&&F<129?+F:parser.midi(F),q=W?parser.midiToFreq(W,440):null;if(!!q){G=G||.2,U=U||{};var Y=U.destination||R.destination||B.destination,K=U.vcoType||R.vcoType||"sine",Z=U.gain||R.gain||.4,j=B.createOscillator();j.type=K,j.frequency.value=q;var Q=B.createGain();return Q.gain.value=Z,j.connect(Q),Q.connect(Y),j.start(D),G>0&&j.stop(D+G),j}}}Soundfont.noteToMidi=parser.midi;var legacy=Soundfont;(function(B){var R=lib$1.exports,F=lib.exports;function D(q,Y,K){if(arguments.length===1)return function(te,ne){return D(q,te,ne)};var Z=K||{},j=Z.isSoundfontURL||G,Q=Z.nameToUrl||U,J=j(Y)?Y:Q(Y,Z.soundfont,Z.format);return R(q,J,{only:Z.only||Z.notes}).then(function(te){var ne=F(q,te,Z).connect(Z.destination?Z.destination:q.destination);return ne.url=J,ne.name=Y,ne})}function G(q){return/\.js(\?.*)?$/i.test(q)}function U(q,Y,K){return K=K==="ogg"?K:"mp3",Y=Y==="FluidR3_GM"?Y:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+Y+"/"+q+"-"+K+".js"}var W=legacy;W.instrument=D,W.nameToUrl=U,B.exports&&(B.exports=W),typeof window!="undefined"&&(window.Soundfont=W)})(lib$2);NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B;const state$2=reactive({sectionStatus:!1,maskStatus:!1,section:[],times:[],timesById:{},sectionBoundingBoxs:[],activeTick:-1,activeTickRepeat:1,showTick:!1,isSpecialShapedScreen:!1,notchHeight:0,fixedKey:0,renderLoading:!1,evaluatings:{},isPauseRecording:!1,feeShow:!1,vipShow:!1,mode:"contact",subjectId:0,activeSpeed:90,baseSpeed:90,activeDetail:null,needTick:!1,skipTick:!1,repeatedBeats:!0,sectionFlash:!1,befireSection:null,isPercussion:!1,enableEvaluation:!0,isAppPlay:!1,partListNames:[],partIndex:0,midiPlayIniting:!1,isSpecialBookCategory:!1,code:"",frozenMode:!1,initRendered:!1,setting:null,activeNote:"",freeRate:.1,zoom:1,renderType:"native"});let toastItem=null;watchEffect(()=>{const B={};for(const R of state$2.times)R.id&&(B[R.id]=R);state$2.timesById=B,state$2.subjectId>0&&(state$2.isPercussion=state$2.subjectId==23||state$2.subjectId==113),state$2.renderLoading?toastItem=Toast({duration:0,message:"\u52A0\u8F7D\u4E2D..."}):toastItem&&(toastItem.close(),toastItem=null)});var eventemitter3={exports:{}};(function(B){var R=Object.prototype.hasOwnProperty,F="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(F=!1));function G(Y,K,Z){this.fn=Y,this.context=K,this.once=Z||!1}function U(Y,K,Z,j,Q){if(typeof Z!="function")throw new TypeError("The listener must be a function");var J=new G(Z,j||Y,Q),te=F?F+K:K;return Y._events[te]?Y._events[te].fn?Y._events[te]=[Y._events[te],J]:Y._events[te].push(J):(Y._events[te]=J,Y._eventsCount++),Y}function W(Y,K){--Y._eventsCount===0?Y._events=new D:delete Y._events[K]}function q(){this._events=new D,this._eventsCount=0}q.prototype.eventNames=function(){var K=[],Z,j;if(this._eventsCount===0)return K;for(j in Z=this._events)R.call(Z,j)&&K.push(F?j.slice(1):j);return Object.getOwnPropertySymbols?K.concat(Object.getOwnPropertySymbols(Z)):K},q.prototype.listeners=function(K){var Z=F?F+K:K,j=this._events[Z];if(!j)return[];if(j.fn)return[j.fn];for(var Q=0,J=j.length,te=new Array(J);Q{var R;B.EngravingRules.CompactMode=!0,B.EngravingRules.DYMinNoteWidth=3,B.EngravingRules.VoiceSpacingMultiplierVexflow=.65,B.EngravingRules.VoiceSpacingAddendVexflow=2,B.EngravingRules.MinSkyBottomDistBetweenStaves=2,B.EngravingRules.MinSkyBottomDistBetweenSystems=2,B.EngravingRules.MinimumStaffLineDistance=4,B.EngravingRules.BetweenStaffDistance=2.5,B.EngravingRules.StaffDistance=3.5,B.EngravingRules.MinimumDistanceBetweenSystems=1,B.EngravingRules.PageBottomMargin=0,B.EngravingRules.PageLeftMargin=2,B.EngravingRules.PageRightMargin=2,B.EngravingRules.PageTopMarginNarrow=3,B.EngravingRules.WedgeEndDistanceBetweenTimestampsFactor=1,B.EngravingRules.RehearsalMarkXOffset=-18,B.EngravingRules.RehearsalMarkYOffset=10,B.EngravingRules.DYWorkId=((R=state$2.activeDetail)==null?void 0:R.parentCategoriesId)||0},useEngravingRules=(B,R)=>{onMounted(()=>{setEngravingRules(B);for(const F in R)if(Object.prototype.hasOwnProperty.call(R,F)){let D=F;const G=R[D];B.EngravingRules[D]=G}})},useOsmd=(B,R,F={})=>{const D=ref();if(B.value){const G=new EngravingRules;for(const[U,W]of Object.entries(F))G[U]=W;D.value=new OpenSheetMusicDisplay(B.value,{followCursor:!1,autoResize:!0,drawSubtitle:!1,drawTitle:!1,autoBeam:!0,drawMetronomeMarks:!1,drawMeasureNumbers:!1,drawComposer:!1,drawLyricist:!1,...R},G)}return D},useOsmdLoader=async(B,R)=>{if(!R)throw"score is required";const F=Toast("\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E...");try{R&&B&&(await B.load(R),B.zoom=formatZoom(),await B.render())}catch{}F.close()},container$3="_container_15puc_1",eyeProtection="_eyeProtection_15puc_22";var styles$g={container:container$3,eyeProtection},lodash={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(B,R){(function(){var F,D="4.17.21",G=200,U="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",W="Expected a function",q="Invalid `variable` option passed into `_.template`",Y="__lodash_hash_undefined__",K=500,Z="__lodash_placeholder__",j=1,Q=2,J=4,te=1,ne=2,ie=1,re=2,oe=4,le=8,fe=16,he=32,ge=64,ce=128,me=256,ye=512,ve=30,pe="...",be=800,xe=16,ue=1,_e=2,Be=3,Ae=1/0,Pe=9007199254740991,Ie=17976931348623157e292,Ce=0/0,Te=4294967295,Se=Te-1,Ne=Te>>>1,Ge=[["ary",ce],["bind",ie],["bindKey",re],["curry",le],["curryRight",fe],["flip",ye],["partial",he],["partialRight",ge],["rearg",me]],ke="[object Arguments]",$e="[object Array]",We="[object AsyncFunction]",Ve="[object Boolean]",qe="[object Date]",et="[object DOMException]",ot="[object Error]",ft="[object Function]",lt="[object GeneratorFunction]",Ee="[object Map]",je="[object Number]",Ke="[object Null]",Oe="[object Object]",Fe="[object Promise]",He="[object Proxy]",Qe="[object RegExp]",tt="[object Set]",Xe="[object String]",rt="[object Symbol]",dt="[object Undefined]",ct="[object WeakMap]",bt="[object WeakSet]",wt="[object ArrayBuffer]",st="[object DataView]",xt="[object Float32Array]",Nt="[object Float64Array]",$t="[object Int8Array]",ai="[object Int16Array]",Ot="[object Int32Array]",Kt="[object Uint8Array]",Qt="[object Uint8ClampedArray]",mt="[object Uint16Array]",ri="[object Uint32Array]",ui=/\b__p \+= '';/g,Zt=/\b(__p \+=) '' \+/g,$i=/(__e\(.*?\)|\b__t\)) \+\n'';/g,yi=/&(?:amp|lt|gt|quot|#39);/g,Wt=/[&<>"']/g,Ki=RegExp(yi.source),an=RegExp(Wt.source),ln=/<%-([\s\S]+?)%>/g,Qn=/<%([\s\S]+?)%>/g,Zi=/<%=([\s\S]+?)%>/g,zi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pn=/^\w*$/,Ti=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cn=/[\\^$.*+?()[\]{}|]/g,ws=RegExp(cn.source),Tn=/^\s+/,es=/\s/,mi=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,vi=/\{\n\/\* \[wrapped with (.+)\] \*/,ts=/,? & /,Ui=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vt=/[()=,{}\[\]\/\s]/,is=/\\(\\)?/g,Fn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ns=/\w*$/,Es=/^[-+]0x[0-9a-f]+$/i,Fi=/^0b[01]+$/i,Ts=/^\[object .+?Constructor\]$/,io=/^0o[0-7]+$/i,no=/^(?:0|[1-9]\d*)$/,so=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ss=/($^)/,Ji=/['\n\r\u2028\u2029\\]/g,rs="\\ud800-\\udfff",ro="\\u0300-\\u036f",oo="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",Ys=ro+oo+ao,Bn="\\u2700-\\u27bf",Xs="a-z\\xdf-\\xf6\\xf8-\\xff",lo="\\xac\\xb1\\xd7\\xf7",Qi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",co="\\u2000-\\u206f",uo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",js="A-Z\\xc0-\\xd6\\xd8-\\xde",Ks="\\ufe0e\\ufe0f",Zs=lo+Qi+co+uo,Ps="['\u2019]",os="["+rs+"]",Js="["+Zs+"]",as="["+Ys+"]",Qs="\\d+",er="["+Bn+"]",tr="["+Xs+"]",ir="[^"+rs+Zs+Qs+Bn+Xs+js+"]",Dn="\\ud83c[\\udffb-\\udfff]",ho="(?:"+as+"|"+Dn+")",nr="[^"+rs+"]",As="(?:\\ud83c[\\udde6-\\uddff]){2}",Ms="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+js+"]",sr="\\u200d",rr="(?:"+tr+"|"+ir+")",fo="(?:"+Pn+"|"+ir+")",or="(?:"+Ps+"(?:d|ll|m|re|s|t|ve))?",ar="(?:"+Ps+"(?:D|LL|M|RE|S|T|VE))?",Cs=ho+"?",lr="["+Ks+"]?",cr="(?:"+sr+"(?:"+[nr,As,Ms].join("|")+")"+lr+Cs+")*",po="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",mo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",On=lr+Cs+cr,go="(?:"+[er,As,Ms].join("|")+")"+On,An="(?:"+[nr+as+"?",as,As,Ms,os].join("|")+")",un=RegExp(Ps,"g"),bo=RegExp(as,"g"),ls=RegExp(Dn+"(?="+Dn+")|"+An+On,"g"),cs=RegExp([Pn+"?"+tr+"+"+or+"(?="+[Js,Pn,"$"].join("|")+")",fo+"+"+ar+"(?="+[Js,Pn+rr,"$"].join("|")+")",Pn+"?"+rr+"+"+or,Pn+"+"+ar,mo,po,Qs,go].join("|"),"g"),yo=RegExp("["+sr+rs+Ys+Ks+"]"),vo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,So=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ur=-1,Yt={};Yt[xt]=Yt[Nt]=Yt[$t]=Yt[ai]=Yt[Ot]=Yt[Kt]=Yt[Qt]=Yt[mt]=Yt[ri]=!0,Yt[ke]=Yt[$e]=Yt[wt]=Yt[Ve]=Yt[st]=Yt[qe]=Yt[ot]=Yt[ft]=Yt[Ee]=Yt[je]=Yt[Oe]=Yt[Qe]=Yt[tt]=Yt[Xe]=Yt[ct]=!1;var Xt={};Xt[ke]=Xt[$e]=Xt[wt]=Xt[st]=Xt[Ve]=Xt[qe]=Xt[xt]=Xt[Nt]=Xt[$t]=Xt[ai]=Xt[Ot]=Xt[Ee]=Xt[je]=Xt[Oe]=Xt[Qe]=Xt[tt]=Xt[Xe]=Xt[rt]=Xt[Kt]=Xt[Qt]=Xt[mt]=Xt[ri]=!0,Xt[ot]=Xt[ft]=Xt[ct]=!1;var us={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},mn={"&":"&","<":"<",">":">",'"':""","'":"'"},Is={"&":"&","<":"<",">":">",""":'"',"'":"'"},hr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fr=parseFloat,en=parseInt,Ls=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,xo=typeof self=="object"&&self&&self.Object===Object&&self,ii=Ls||xo||Function("return this")(),Vn=R&&!R.nodeType&&R,Pi=Vn&&!0&&B&&!B.nodeType&&B,Gn=Pi&&Pi.exports===Vn,$n=Gn&&Ls.process,Si=function(){try{var Ze=Pi&&Pi.require&&Pi.require("util").types;return Ze||$n&&$n.binding&&$n.binding("util")}catch{}}(),dr=Si&&Si.isArrayBuffer,pr=Si&&Si.isDate,mr=Si&&Si.isMap,zn=Si&&Si.isRegExp,gr=Si&&Si.isSet,br=Si&&Si.isTypedArray;function xi(Ze,at,it){switch(it.length){case 0:return Ze.call(at);case 1:return Ze.call(at,it[0]);case 2:return Ze.call(at,it[0],it[1]);case 3:return Ze.call(at,it[0],it[1],it[2])}return Ze.apply(at,it)}function Le(Ze,at,it,vt){for(var Ct=-1,Ut=Ze==null?0:Ze.length;++Ct-1}function Bt(Ze,at,it){for(var vt=-1,Ct=Ze==null?0:Ze.length;++vt-1;);return it}function Ta(Ze,at){for(var it=Ze.length;it--&&Ii(at,Ze[it],0)>-1;);return it}function Sc(Ze,at){for(var it=Ze.length,vt=0;it--;)Ze[it]===at&&++vt;return vt}var xc=wo(us),_c=wo(mn);function wc(Ze){return"\\"+hr[Ze]}function Ec(Ze,at){return Ze==null?F:Ze[at]}function hs(Ze){return yo.test(Ze)}function Tc(Ze){return vo.test(Ze)}function Pc(Ze){for(var at,it=[];!(at=Ze.next()).done;)it.push(at.value);return it}function Ao(Ze){var at=-1,it=Array(Ze.size);return Ze.forEach(function(vt,Ct){it[++at]=[Ct,vt]}),it}function Pa(Ze,at){return function(it){return Ze(at(it))}}function Mn(Ze,at){for(var it=-1,vt=Ze.length,Ct=0,Ut=[];++it-1}function du(se,ae){var de=this.__data__,we=kr(de,se);return we<0?(++this.size,de.push([se,ae])):de[we][1]=ae,this}gn.prototype.clear=cu,gn.prototype.delete=uu,gn.prototype.get=hu,gn.prototype.has=fu,gn.prototype.set=du;function bn(se){var ae=-1,de=se==null?0:se.length;for(this.clear();++ae=ae?se:ae)),se}function qi(se,ae,de,we,Me,De){var Ue,Ye=ae&j,Je=ae&Q,ut=ae&J;if(de&&(Ue=Me?de(se,we,Me,De):de(se)),Ue!==F)return Ue;if(!Jt(se))return se;var ht=It(se);if(ht){if(Ue=bh(se),!Ye)return Li(se,Ue)}else{var pt=bi(se),yt=pt==ft||pt==lt;if(kn(se))return ll(se,Ye);if(pt==Oe||pt==ke||yt&&!Me){if(Ue=Je||yt?{}:Al(se),!Ye)return Je?oh(se,Cu(Ue,se)):rh(se,Oa(Ue,se))}else{if(!Xt[pt])return Me?se:{};Ue=yh(se,pt,Ye)}}De||(De=new sn);var _t=De.get(se);if(_t)return _t;De.set(se,Ue),ic(se)?se.forEach(function(Mt){Ue.add(qi(Mt,ae,de,Mt,se,De))}):ec(se)&&se.forEach(function(Mt,Ft){Ue.set(Ft,qi(Mt,ae,de,Ft,se,De))});var At=ut?Je?Qo:Jo:Je?Ri:fi,Rt=ht?F:At(se);return ze(Rt||se,function(Mt,Ft){Rt&&(Ft=Mt,Mt=se[Ft]),Os(Ue,Ft,qi(Mt,ae,de,Ft,se,De))}),Ue}function Iu(se){var ae=fi(se);return function(de){return Va(de,se,ae)}}function Va(se,ae,de){var we=de.length;if(se==null)return!we;for(se=jt(se);we--;){var Me=de[we],De=ae[Me],Ue=se[Me];if(Ue===F&&!(Me in se)||!De(Ue))return!1}return!0}function Ga(se,ae,de){if(typeof se!="function")throw new Wi(W);return Hs(function(){se.apply(F,de)},ae)}function Vs(se,ae,de,we){var Me=-1,De=St,Ue=!0,Ye=se.length,Je=[],ut=ae.length;if(!Ye)return Je;de&&(ae=Tt(ae,Bi(de))),we?(De=Bt,Ue=!1):ae.length>=G&&(De=Ns,Ue=!1,ae=new Yn(ae));e:for(;++MeMe?0:Me+de),we=we===F||we>Me?Me:Lt(we),we<0&&(we+=Me),we=de>we?0:sc(we);de0&&de(Ye)?ae>1?pi(Ye,ae-1,de,we,Me):zt(Me,Ye):we||(Me[Me.length]=Ye)}return Me}var ko=pl(),Ua=pl(!0);function hn(se,ae){return se&&ko(se,ae,fi)}function Fo(se,ae){return se&&Ua(se,ae,fi)}function Br(se,ae){return Et(ae,function(de){return _n(se[de])})}function jn(se,ae){ae=Nn(ae,se);for(var de=0,we=ae.length;se!=null&&deae}function Ru(se,ae){return se!=null&&qt.call(se,ae)}function ku(se,ae){return se!=null&&ae in jt(se)}function Fu(se,ae,de){return se>=gi(ae,de)&&se=120&&ht.length>=120)?new Yn(Ue&&ht):F}ht=se[0];var pt=-1,yt=Ye[0];e:for(;++pt-1;)Ye!==se&&Ar.call(Ye,Je,1),Ar.call(se,Je,1);return se}function el(se,ae){for(var de=se?ae.length:0,we=de-1;de--;){var Me=ae[de];if(de==we||Me!==De){var De=Me;xn(Me)?Ar.call(se,Me,1):Ho(se,Me)}}return se}function zo(se,ae){return se+Ir(ka()*(ae-se+1))}function Xu(se,ae,de,we){for(var Me=-1,De=ci(Cr((ae-se)/(de||1)),0),Ue=it(De);De--;)Ue[we?De:++Me]=se,se+=de;return Ue}function Uo(se,ae){var de="";if(!se||ae<1||ae>Pe)return de;do ae%2&&(de+=se),ae=Ir(ae/2),ae&&(se+=se);while(ae);return de}function kt(se,ae){return oa(Il(se,ae,ki),se+"")}function ju(se){return Da(_s(se))}function Ku(se,ae){var de=_s(se);return Yr(de,Xn(ae,0,de.length))}function zs(se,ae,de,we){if(!Jt(se))return se;ae=Nn(ae,se);for(var Me=-1,De=ae.length,Ue=De-1,Ye=se;Ye!=null&&++MeMe?0:Me+ae),de=de>Me?Me:de,de<0&&(de+=Me),Me=ae>de?0:de-ae>>>0,ae>>>=0;for(var De=it(Me);++we>>1,Ue=se[De];Ue!==null&&!Oi(Ue)&&(de?Ue<=ae:Ue=G){var ut=ae?null:uh(se);if(ut)return vr(ut);Ue=!1,Me=Ns,Je=new Yn}else Je=ae?[]:Ye;e:for(;++we=we?se:Yi(se,ae,de)}var al=$c||function(se){return ii.clearTimeout(se)};function ll(se,ae){if(ae)return se.slice();var de=se.length,we=Ca?Ca(de):new se.constructor(de);return se.copy(we),we}function jo(se){var ae=new se.constructor(se.byteLength);return new Tr(ae).set(new Tr(se)),ae}function th(se,ae){var de=ae?jo(se.buffer):se.buffer;return new se.constructor(de,se.byteOffset,se.byteLength)}function ih(se){var ae=new se.constructor(se.source,ns.exec(se));return ae.lastIndex=se.lastIndex,ae}function nh(se){return Ds?jt(Ds.call(se)):{}}function cl(se,ae){var de=ae?jo(se.buffer):se.buffer;return new se.constructor(de,se.byteOffset,se.length)}function ul(se,ae){if(se!==ae){var de=se!==F,we=se===null,Me=se===se,De=Oi(se),Ue=ae!==F,Ye=ae===null,Je=ae===ae,ut=Oi(ae);if(!Ye&&!ut&&!De&&se>ae||De&&Ue&&Je&&!Ye&&!ut||we&&Ue&&Je||!de&&Je||!Me)return 1;if(!we&&!De&&!ut&&se=Ye)return Je;var ut=de[we];return Je*(ut=="desc"?-1:1)}}return se.index-ae.index}function hl(se,ae,de,we){for(var Me=-1,De=se.length,Ue=de.length,Ye=-1,Je=ae.length,ut=ci(De-Ue,0),ht=it(Je+ut),pt=!we;++Ye1?de[Me-1]:F,Ue=Me>2?de[2]:F;for(De=se.length>3&&typeof De=="function"?(Me--,De):F,Ue&&wi(de[0],de[1],Ue)&&(De=Me<3?F:De,Me=1),ae=jt(ae);++we-1?Me[De?ae[Ue]:Ue]:F}}function bl(se){return Sn(function(ae){var de=ae.length,we=de,Me=Hi.prototype.thru;for(se&&ae.reverse();we--;){var De=ae[we];if(typeof De!="function")throw new Wi(W);if(Me&&!Ue&&Hr(De)=="wrapper")var Ue=new Hi([],!0)}for(we=Ue?we:de;++we1&&Gt.reverse(),ht&&JeYe))return!1;var ut=De.get(se),ht=De.get(ae);if(ut&&ht)return ut==ae&&ht==se;var pt=-1,yt=!0,_t=de&ne?new Yn:F;for(De.set(se,ae),De.set(ae,se);++pt1?"& ":"")+ae[we],ae=ae.join(de>2?", ":" "),se.replace(mi,`{ /* [wrapped with `+ae+`] */ `)}function Sh(se){return It(se)||Jn(se)||!!(Na&&se&&se[Na])}function xn(se,ae){var de=typeof se;return ae=ae==null?Pe:ae,!!ae&&(de=="number"||de!="symbol"&&no.test(se))&&se>-1&&se%1==0&&se0){if(++ae>=be)return arguments[0]}else ae=0;return se.apply(F,arguments)}}function Yr(se,ae){var de=-1,we=se.length,Me=we-1;for(ae=ae===F?we:ae;++de1?se[ae-1]:F;return de=typeof de=="function"?(se.pop(),de):F,zl(se,de)});function Ul(se){var ae=Re(se);return ae.__chain__=!0,ae}function Nf(se,ae){return ae(se),se}function Xr(se,ae){return ae(se)}var Rf=Sn(function(se){var ae=se.length,de=ae?se[0]:0,we=this.__wrapped__,Me=function(De){return Ro(De,se)};return ae>1||this.__actions__.length||!(we instanceof Dt)||!xn(de)?this.thru(Me):(we=we.slice(de,+de+(ae?1:0)),we.__actions__.push({func:Xr,args:[Me],thisArg:F}),new Hi(we,this.__chain__).thru(function(De){return ae&&!De.length&&De.push(F),De}))});function kf(){return Ul(this)}function Ff(){return new Hi(this.value(),this.__chain__)}function Bf(){this.__values__===F&&(this.__values__=nc(this.value()));var se=this.__index__>=this.__values__.length,ae=se?F:this.__values__[this.__index__++];return{done:se,value:ae}}function Df(){return this}function Of(se){for(var ae,de=this;de instanceof Rr;){var we=Bl(de);we.__index__=0,we.__values__=F,ae?Me.__wrapped__=we:ae=we;var Me=we;de=de.__wrapped__}return Me.__wrapped__=se,ae}function Vf(){var se=this.__wrapped__;if(se instanceof Dt){var ae=se;return this.__actions__.length&&(ae=new Dt(this)),ae=ae.reverse(),ae.__actions__.push({func:Xr,args:[aa],thisArg:F}),new Hi(ae,this.__chain__)}return this.thru(aa)}function Gf(){return rl(this.__wrapped__,this.__actions__)}var $f=Gr(function(se,ae,de){qt.call(se,de)?++se[de]:yn(se,de,1)});function zf(se,ae,de){var we=It(se)?gt:Lu;return de&&wi(se,ae,de)&&(ae=F),we(se,Pt(ae,3))}function Uf(se,ae){var de=It(se)?Et:za;return de(se,Pt(ae,3))}var Wf=gl(Dl),Hf=gl(Ol);function qf(se,ae){return pi(jr(se,ae),1)}function Yf(se,ae){return pi(jr(se,ae),Ae)}function Xf(se,ae,de){return de=de===F?1:Lt(de),pi(jr(se,ae),de)}function Wl(se,ae){var de=It(se)?ze:In;return de(se,Pt(ae,3))}function Hl(se,ae){var de=It(se)?nt:$a;return de(se,Pt(ae,3))}var jf=Gr(function(se,ae,de){qt.call(se,de)?se[de].push(ae):yn(se,de,[ae])});function Kf(se,ae,de,we){se=Ni(se)?se:_s(se),de=de&&!we?Lt(de):0;var Me=se.length;return de<0&&(de=ci(Me+de,0)),eo(se)?de<=Me&&se.indexOf(ae,de)>-1:!!Me&&Ii(se,ae,de)>-1}var Zf=kt(function(se,ae,de){var we=-1,Me=typeof ae=="function",De=Ni(se)?it(se.length):[];return In(se,function(Ue){De[++we]=Me?xi(ae,Ue,de):Gs(Ue,ae,de)}),De}),Jf=Gr(function(se,ae,de){yn(se,de,ae)});function jr(se,ae){var de=It(se)?Tt:Xa;return de(se,Pt(ae,3))}function Qf(se,ae,de,we){return se==null?[]:(It(ae)||(ae=ae==null?[]:[ae]),de=we?F:de,It(de)||(de=de==null?[]:[de]),Ja(se,ae,de))}var ed=Gr(function(se,ae,de){se[de?0:1].push(ae)},function(){return[[],[]]});function td(se,ae,de){var we=It(se)?ei:_a,Me=arguments.length<3;return we(se,Pt(ae,4),de,Me,In)}function nd(se,ae,de){var we=It(se)?di:_a,Me=arguments.length<3;return we(se,Pt(ae,4),de,Me,$a)}function sd(se,ae){var de=It(se)?Et:za;return de(se,Jr(Pt(ae,3)))}function rd(se){var ae=It(se)?Da:ju;return ae(se)}function od(se,ae,de){(de?wi(se,ae,de):ae===F)?ae=1:ae=Lt(ae);var we=It(se)?Pu:Ku;return we(se,ae)}function ad(se){var ae=It(se)?Au:Ju;return ae(se)}function ld(se){if(se==null)return 0;if(Ni(se))return eo(se)?fs(se):se.length;var ae=bi(se);return ae==Ee||ae==tt?se.size:Vo(se).length}function cd(se,ae,de){var we=It(se)?hi:Qu;return de&&wi(se,ae,de)&&(ae=F),we(se,Pt(ae,3))}var ud=kt(function(se,ae){if(se==null)return[];var de=ae.length;return de>1&&wi(se,ae[0],ae[1])?ae=[]:de>2&&wi(ae[0],ae[1],ae[2])&&(ae=[ae[0]]),Ja(se,pi(ae,1),[])}),Kr=zc||function(){return ii.Date.now()};function hd(se,ae){if(typeof ae!="function")throw new Wi(W);return se=Lt(se),function(){if(--se<1)return ae.apply(this,arguments)}}function ql(se,ae,de){return ae=de?F:ae,ae=se&&ae==null?se.length:ae,vn(se,ce,F,F,F,F,ae)}function Yl(se,ae){var de;if(typeof ae!="function")throw new Wi(W);return se=Lt(se),function(){return--se>0&&(de=ae.apply(this,arguments)),se<=1&&(ae=F),de}}var ca=kt(function(se,ae,de){var we=ie;if(de.length){var Me=Mn(de,Ss(ca));we|=he}return vn(se,we,ae,de,Me)}),Xl=kt(function(se,ae,de){var we=ie|re;if(de.length){var Me=Mn(de,Ss(Xl));we|=he}return vn(ae,we,se,de,Me)});function jl(se,ae,de){ae=de?F:ae;var we=vn(se,le,F,F,F,F,F,ae);return we.placeholder=jl.placeholder,we}function Kl(se,ae,de){ae=de?F:ae;var we=vn(se,fe,F,F,F,F,F,ae);return we.placeholder=Kl.placeholder,we}function Zl(se,ae,de){var we,Me,De,Ue,Ye,Je,ut=0,ht=!1,pt=!1,yt=!0;if(typeof se!="function")throw new Wi(W);ae=ji(ae)||0,Jt(de)&&(ht=!!de.leading,pt="maxWait"in de,De=pt?ci(ji(de.maxWait)||0,ae):De,yt="trailing"in de?!!de.trailing:yt);function _t(si){var on=we,En=Me;return we=Me=F,ut=si,Ue=se.apply(En,on),Ue}function At(si){return ut=si,Ye=Hs(Ft,ae),ht?_t(si):Ue}function Rt(si){var on=si-Je,En=si-ut,bc=ae-on;return pt?gi(bc,De-En):bc}function Mt(si){var on=si-Je,En=si-ut;return Je===F||on>=ae||on<0||pt&&En>=De}function Ft(){var si=Kr();if(Mt(si))return Gt(si);Ye=Hs(Ft,Rt(si))}function Gt(si){return Ye=F,yt&&we?_t(si):(we=Me=F,Ue)}function Vi(){Ye!==F&&al(Ye),ut=0,we=Je=Me=Ye=F}function Ei(){return Ye===F?Ue:Gt(Kr())}function Gi(){var si=Kr(),on=Mt(si);if(we=arguments,Me=this,Je=si,on){if(Ye===F)return At(Je);if(pt)return al(Ye),Ye=Hs(Ft,ae),_t(Je)}return Ye===F&&(Ye=Hs(Ft,ae)),Ue}return Gi.cancel=Vi,Gi.flush=Ei,Gi}var fd=kt(function(se,ae){return Ga(se,1,ae)}),dd=kt(function(se,ae,de){return Ga(se,ji(ae)||0,de)});function pd(se){return vn(se,ye)}function Zr(se,ae){if(typeof se!="function"||ae!=null&&typeof ae!="function")throw new Wi(W);var de=function(){var we=arguments,Me=ae?ae.apply(this,we):we[0],De=de.cache;if(De.has(Me))return De.get(Me);var Ue=se.apply(this,we);return de.cache=De.set(Me,Ue)||De,Ue};return de.cache=new(Zr.Cache||bn),de}Zr.Cache=bn;function Jr(se){if(typeof se!="function")throw new Wi(W);return function(){var ae=arguments;switch(ae.length){case 0:return!se.call(this);case 1:return!se.call(this,ae[0]);case 2:return!se.call(this,ae[0],ae[1]);case 3:return!se.call(this,ae[0],ae[1],ae[2])}return!se.apply(this,ae)}}function md(se){return Yl(2,se)}var gd=eh(function(se,ae){ae=ae.length==1&&It(ae[0])?Tt(ae[0],Bi(Pt())):Tt(pi(ae,1),Bi(Pt()));var de=ae.length;return kt(function(we){for(var Me=-1,De=gi(we.length,de);++Me=ae}),Jn=Ha(function(){return arguments}())?Ha:function(se){return ti(se)&&qt.call(se,"callee")&&!La.call(se,"callee")},It=it.isArray,Ld=dr?Bi(dr):Du;function Ni(se){return se!=null&&Qr(se.length)&&!_n(se)}function ni(se){return ti(se)&&Ni(se)}function Nd(se){return se===!0||se===!1||ti(se)&&_i(se)==Ve}var kn=Wc||xa,Rd=pr?Bi(pr):Ou;function kd(se){return ti(se)&&se.nodeType===1&&!qs(se)}function Fd(se){if(se==null)return!0;if(Ni(se)&&(It(se)||typeof se=="string"||typeof se.splice=="function"||kn(se)||xs(se)||Jn(se)))return!se.length;var ae=bi(se);if(ae==Ee||ae==tt)return!se.size;if(Ws(se))return!Vo(se).length;for(var de in se)if(qt.call(se,de))return!1;return!0}function Bd(se,ae){return $s(se,ae)}function Dd(se,ae,de){de=typeof de=="function"?de:F;var we=de?de(se,ae):F;return we===F?$s(se,ae,F,de):!!we}function ha(se){if(!ti(se))return!1;var ae=_i(se);return ae==ot||ae==et||typeof se.message=="string"&&typeof se.name=="string"&&!qs(se)}function Od(se){return typeof se=="number"&&Ra(se)}function _n(se){if(!Jt(se))return!1;var ae=_i(se);return ae==ft||ae==lt||ae==We||ae==He}function Ql(se){return typeof se=="number"&&se==Lt(se)}function Qr(se){return typeof se=="number"&&se>-1&&se%1==0&&se<=Pe}function Jt(se){var ae=typeof se;return se!=null&&(ae=="object"||ae=="function")}function ti(se){return se!=null&&typeof se=="object"}var ec=mr?Bi(mr):Gu;function Vd(se,ae){return se===ae||Oo(se,ae,ta(ae))}function Gd(se,ae,de){return de=typeof de=="function"?de:F,Oo(se,ae,ta(ae),de)}function $d(se){return tc(se)&&se!=+se}function zd(se){if(wh(se))throw new Ct(U);return qa(se)}function Ud(se){return se===null}function Wd(se){return se==null}function tc(se){return typeof se=="number"||ti(se)&&_i(se)==je}function qs(se){if(!ti(se)||_i(se)!=Oe)return!1;var ae=Pr(se);if(ae===null)return!0;var de=qt.call(ae,"constructor")&&ae.constructor;return typeof de=="function"&&de instanceof de&&_r.call(de)==Oc}var fa=zn?Bi(zn):$u;function Hd(se){return Ql(se)&&se>=-Pe&&se<=Pe}var ic=gr?Bi(gr):zu;function eo(se){return typeof se=="string"||!It(se)&&ti(se)&&_i(se)==Xe}function Oi(se){return typeof se=="symbol"||ti(se)&&_i(se)==rt}var xs=br?Bi(br):Uu;function qd(se){return se===F}function Yd(se){return ti(se)&&bi(se)==ct}function Xd(se){return ti(se)&&_i(se)==bt}var jd=Wr(Go),Kd=Wr(function(se,ae){return se<=ae});function nc(se){if(!se)return[];if(Ni(se))return eo(se)?nn(se):Li(se);if(Rs&&se[Rs])return Pc(se[Rs]());var ae=bi(se),de=ae==Ee?Ao:ae==tt?vr:_s;return de(se)}function wn(se){if(!se)return se===0?se:0;if(se=ji(se),se===Ae||se===-Ae){var ae=se<0?-1:1;return ae*Ie}return se===se?se:0}function Lt(se){var ae=wn(se),de=ae%1;return ae===ae?de?ae-de:ae:0}function sc(se){return se?Xn(Lt(se),0,Te):0}function ji(se){if(typeof se=="number")return se;if(Oi(se))return Ce;if(Jt(se)){var ae=typeof se.valueOf=="function"?se.valueOf():se;se=Jt(ae)?ae+"":ae}if(typeof se!="string")return se===0?se:+se;se=wa(se);var de=Fi.test(se);return de||io.test(se)?en(se.slice(2),de?2:8):Es.test(se)?Ce:+se}function rc(se){return fn(se,Ri(se))}function Zd(se){return se?Xn(Lt(se),-Pe,Pe):se===0?se:0}function Ht(se){return se==null?"":Di(se)}var Jd=ys(function(se,ae){if(Ws(ae)||Ni(ae)){fn(ae,fi(ae),se);return}for(var de in ae)qt.call(ae,de)&&Os(se,de,ae[de])}),oc=ys(function(se,ae){fn(ae,Ri(ae),se)}),to=ys(function(se,ae,de,we){fn(ae,Ri(ae),se,we)}),Qd=ys(function(se,ae,de,we){fn(ae,fi(ae),se,we)}),ep=Sn(Ro);function tp(se,ae){var de=bs(se);return ae==null?de:Oa(de,ae)}var ip=kt(function(se,ae){se=jt(se);var de=-1,we=ae.length,Me=we>2?ae[2]:F;for(Me&&wi(ae[0],ae[1],Me)&&(we=1);++de1),De}),fn(se,Qo(se),de),we&&(de=qi(de,j|Q|J,hh));for(var Me=ae.length;Me--;)Ho(de,ae[Me]);return de});function Sp(se,ae){return lc(se,Jr(Pt(ae)))}var xp=Sn(function(se,ae){return se==null?{}:qu(se,ae)});function lc(se,ae){if(se==null)return{};var de=Tt(Qo(se),function(we){return[we]});return ae=Pt(ae),Qa(se,de,function(we,Me){return ae(we,Me[0])})}function _p(se,ae,de){ae=Nn(ae,se);var we=-1,Me=ae.length;for(Me||(Me=1,se=F);++weae){var we=se;se=ae,ae=we}if(de||se%1||ae%1){var Me=ka();return gi(se+Me*(ae-se+fr("1e-"+((Me+"").length-1))),ae)}return zo(se,ae)}var Rp=vs(function(se,ae,de){return ae=ae.toLowerCase(),se+(de?hc(ae):ae)});function hc(se){return ma(Ht(se).toLowerCase())}function fc(se){return se=Ht(se),se&&se.replace(so,xc).replace(bo,"")}function kp(se,ae,de){se=Ht(se),ae=Di(ae);var we=se.length;de=de===F?we:Xn(Lt(de),0,we);var Me=de;return de-=ae.length,de>=0&&se.slice(de,Me)==ae}function Fp(se){return se=Ht(se),se&&an.test(se)?se.replace(Wt,_c):se}function Bp(se){return se=Ht(se),se&&ws.test(se)?se.replace(cn,"\\$&"):se}var Dp=vs(function(se,ae,de){return se+(de?"-":"")+ae.toLowerCase()}),Op=vs(function(se,ae,de){return se+(de?" ":"")+ae.toLowerCase()}),Vp=ml("toLowerCase");function Gp(se,ae,de){se=Ht(se),ae=Lt(ae);var we=ae?fs(se):0;if(!ae||we>=ae)return se;var Me=(ae-we)/2;return Ur(Ir(Me),de)+se+Ur(Cr(Me),de)}function $p(se,ae,de){se=Ht(se),ae=Lt(ae);var we=ae?fs(se):0;return ae&&we>>0,de?(se=Ht(se),se&&(typeof ae=="string"||ae!=null&&!fa(ae))&&(ae=Di(ae),!ae&&hs(se))?Rn(nn(se),0,de):se.split(ae,de)):[]}var Xp=vs(function(se,ae,de){return se+(de?" ":"")+ma(ae)});function jp(se,ae,de){return se=Ht(se),de=de==null?0:Xn(Lt(de),0,se.length),ae=Di(ae),se.slice(de,de+ae.length)==ae}function Kp(se,ae,de){var we=Re.templateSettings;de&&wi(se,ae,de)&&(ae=F),se=Ht(se),ae=to({},ae,we,_l);var Me=to({},ae.imports,we.imports,_l),De=fi(Me),Ue=Po(Me,De),Ye,Je,ut=0,ht=ae.interpolate||ss,pt="__p += '",yt=Mo((ae.escape||ss).source+"|"+ht.source+"|"+(ht===Zi?Fn:ss).source+"|"+(ae.evaluate||ss).source+"|$","g"),_t="//# sourceURL="+(qt.call(ae,"sourceURL")?(ae.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ur+"]")+` `;se.replace(yt,function(Mt,Ft,Gt,Vi,Ei,Gi){return Gt||(Gt=Vi),pt+=se.slice(ut,Gi).replace(Ji,wc),Ft&&(Ye=!0,pt+=`' + __e(`+Ft+`) + '`),Ei&&(Je=!0,pt+=`'; `+Ei+`; __p += '`),Gt&&(pt+=`' + ((__t = (`+Gt+`)) == null ? '' : __t) + '`),ut=Gi+Mt.length,Mt}),pt+=`'; `;var At=qt.call(ae,"variable")&&ae.variable;if(!At)pt=`with (obj) { `+pt+` } `;else if(Vt.test(At))throw new Ct(q);pt=(Je?pt.replace(ui,""):pt).replace(Zt,"$1").replace($i,"$1;"),pt="function("+(At||"obj")+`) { `+(At?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Ye?", __e = _.escape":"")+(Je?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+pt+`return __p }`;var Rt=mc(function(){return Ut(De,_t+"return "+pt).apply(F,Ue)});if(Rt.source=pt,ha(Rt))throw Rt;return Rt}function Zp(se){return Ht(se).toLowerCase()}function Jp(se){return Ht(se).toUpperCase()}function Qp(se,ae,de){if(se=Ht(se),se&&(de||ae===F))return wa(se);if(!se||!(ae=Di(ae)))return se;var we=nn(se),Me=nn(ae),De=Ea(we,Me),Ue=Ta(we,Me)+1;return Rn(we,De,Ue).join("")}function em(se,ae,de){if(se=Ht(se),se&&(de||ae===F))return se.slice(0,Aa(se)+1);if(!se||!(ae=Di(ae)))return se;var we=nn(se),Me=Ta(we,nn(ae))+1;return Rn(we,0,Me).join("")}function tm(se,ae,de){if(se=Ht(se),se&&(de||ae===F))return se.replace(Tn,"");if(!se||!(ae=Di(ae)))return se;var we=nn(se),Me=Ea(we,nn(ae));return Rn(we,Me).join("")}function im(se,ae){var de=ve,we=pe;if(Jt(ae)){var Me="separator"in ae?ae.separator:Me;de="length"in ae?Lt(ae.length):de,we="omission"in ae?Di(ae.omission):we}se=Ht(se);var De=se.length;if(hs(se)){var Ue=nn(se);De=Ue.length}if(de>=De)return se;var Ye=de-fs(we);if(Ye<1)return we;var Je=Ue?Rn(Ue,0,Ye).join(""):se.slice(0,Ye);if(Me===F)return Je+we;if(Ue&&(Ye+=Je.length-Ye),fa(Me)){if(se.slice(Ye).search(Me)){var ut,ht=Je;for(Me.global||(Me=Mo(Me.source,Ht(ns.exec(Me))+"g")),Me.lastIndex=0;ut=Me.exec(ht);)var pt=ut.index;Je=Je.slice(0,pt===F?Ye:pt)}}else if(se.indexOf(Di(Me),Ye)!=Ye){var yt=Je.lastIndexOf(Me);yt>-1&&(Je=Je.slice(0,yt))}return Je+we}function nm(se){return se=Ht(se),se&&Ki.test(se)?se.replace(yi,Ic):se}var sm=vs(function(se,ae,de){return se+(de?" ":"")+ae.toUpperCase()}),ma=ml("toUpperCase");function dc(se,ae,de){return se=Ht(se),ae=de?F:ae,ae===F?Tc(se)?Rc(se):Mi(se):se.match(ae)||[]}var mc=kt(function(se,ae){try{return xi(se,F,ae)}catch(de){return ha(de)?de:new Ct(de)}}),rm=Sn(function(se,ae){return ze(ae,function(de){de=dn(de),yn(se,de,ca(se[de],se))}),se});function om(se){var ae=se==null?0:se.length,de=Pt();return se=ae?Tt(se,function(we){if(typeof we[1]!="function")throw new Wi(W);return[de(we[0]),we[1]]}):[],kt(function(we){for(var Me=-1;++MePe)return[];var de=Te,we=gi(se,Te);ae=Pt(ae),se-=Te;for(var Me=To(we,ae);++de0||ae<0)?new Dt(de):(se<0?de=de.takeRight(-se):se&&(de=de.drop(se)),ae!==F&&(ae=Lt(ae),de=ae<0?de.dropRight(-ae):de.take(ae-se)),de)},Dt.prototype.takeRightWhile=function(se){return this.reverse().takeWhile(se).reverse()},Dt.prototype.toArray=function(){return this.take(Te)},hn(Dt.prototype,function(se,ae){var de=/^(?:filter|find|map|reject)|While$/.test(ae),we=/^(?:head|last)$/.test(ae),Me=Re[we?"take"+(ae=="last"?"Right":""):ae],De=we||/^find/.test(ae);!Me||(Re.prototype[ae]=function(){var Ue=this.__wrapped__,Ye=we?[1]:arguments,Je=Ue instanceof Dt,ut=Ye[0],ht=Je||It(Ue),pt=function(Ft){var Gt=Me.apply(Re,zt([Ft],Ye));return we&&yt?Gt[0]:Gt};ht&&de&&typeof ut=="function"&&ut.length!=1&&(Je=ht=!1);var yt=this.__chain__,_t=!!this.__actions__.length,At=De&&!yt,Rt=Je&&!_t;if(!De&&ht){Ue=Rt?Ue:new Dt(this);var Mt=se.apply(Ue,Ye);return Mt.__actions__.push({func:Xr,args:[pt],thisArg:F}),new Hi(Mt,yt)}return At&&Rt?se.apply(this,Ye):(Mt=this.thru(pt),At?we?Mt.value()[0]:Mt.value():Mt)})}),ze(["pop","push","shift","sort","splice","unshift"],function(se){var ae=Sr[se],de=/^(?:push|sort|unshift)$/.test(se)?"tap":"thru",we=/^(?:pop|shift)$/.test(se);Re.prototype[se]=function(){var Me=arguments;if(we&&!this.__chain__){var De=this.value();return ae.apply(It(De)?De:[],Me)}return this[de](function(Ue){return ae.apply(It(Ue)?Ue:[],Me)})}}),hn(Dt.prototype,function(se,ae){var de=Re[ae];if(de){var we=de.name+"";qt.call(gs,we)||(gs[we]=[]),gs[we].push({name:ae,func:de})}}),gs[$r(F,re).name]=[{name:"wrapper",func:F}],Dt.prototype.clone=tu,Dt.prototype.reverse=iu,Dt.prototype.value=nu,Re.prototype.at=Rf,Re.prototype.chain=kf,Re.prototype.commit=Ff,Re.prototype.next=Bf,Re.prototype.plant=Of,Re.prototype.reverse=Vf,Re.prototype.toJSON=Re.prototype.valueOf=Re.prototype.value=Gf,Re.prototype.first=Re.prototype.head,Rs&&(Re.prototype[Rs]=Df),Re},ds=kc();Pi?((Pi.exports=ds)._=ds,Vn._=ds):ii._=ds}).call(commonjsGlobal$1)})(lodash,lodash.exports);const browserInfo$5=browser(),getLinkId$1=()=>location.hash.split("?")[0].split("/").pop()||"",retain=B=>Math.ceil(B*1e6)/1e6,formatLyricsEntries=B=>{var D,G;const R=((D=B.parentStaffEntry)==null?void 0:D.voiceEntries)||[],F=[];for(const U of R)if((G=U.lyricsEntries)!=null&&G.table){const W=Object.values(U.lyricsEntries.table);for(const q of W)F.push(q==null?void 0:q.value.text)}return F},getMeasureDurationDiff=B=>{const{realValue:R}=B.activeTimeSignature,{realValue:F}=B.duration;return R-F},getAllNodes=B=>{var K,Z,j,Q,J,te,ne,ie,re,oe,le,fe,he,ge,ce,me,ye,ve,pe,be,xe,ue,_e,Be,Ae,Pe,Ie,Ce,Te,Se,Ne,Ge,ke,$e,We,Ve,qe,et,ot,ft,lt;const R=getLinkId$1();let F=browserInfo$5.huawei?.08:0;const D=[],G=[],U=[],{baseSpeed:W=100}=state$2,q=(Ee,je)=>{var He,Qe,tt,Xe,rt,dt;return["906"].includes(R)?((He=je.measures[0])==null?void 0:He.realKey)||Ee:["782","784"].includes(R)&&[14,16,30,32].includes((Qe=je.firstVerticalMeasure)==null?void 0:Qe.measureNumber)?((tt=D[D.length-1])==null?void 0:tt.realKey)||Ee:["900","901","640","641","739","740","800","801","773","774","869","872","714","715"].includes(R)&&(((Xe=je.firstVerticalMeasure)==null?void 0:Xe.measureNumber)===3||((rt=je.firstVerticalMeasure)==null?void 0:rt.measureNumber)===9)&&((dt=je.measures[0])==null?void 0:dt.realKey)||Ee};if(B!=null&&B.cursor){try{B.cursor.reset()}catch{}const Ee=B.cursor.iterator;let je=0,Ke=0,Oe=[],Fe=[],He=0,Qe=0,tt=0,Xe="quarter",rt=1,dt=0,ct=0,bt=0,wt=0,st=!1,xt=0;for(;!Ee.endReached;){const Nt=B.cursor.cursorElement,$t={move:!1};Nt&&($t.move=!0,$t.x=Nt.offsetLeft,$t.y=Nt.offsetTop,$t.w=Nt.offsetWidth,$t.h=Nt.offsetHeight);const ai=(K=Ee.currentVoiceEntries)!=null&&K[0]?[(Z=Ee.currentVoiceEntries)==null?void 0:Z[0]]:[],Ot=(j=Ee.currentVoiceEntries)==null?void 0:j[1];let Kt=!1;for(const Qt of ai){let mt=Qt.notes[0];if(["Piano"].includes((Q=state$2.activeDetail)==null?void 0:Q.code)){let ri=[];try{ri=(J=Ee.currentVoiceEntries)==null?void 0:J.map(ui=>ui.notes).flat().sort((ui,Zt)=>ui.Length.realValue-Zt.Length.realValue),mt=ri[0]}catch{}}if(mt){if(Ke===0&&U.push(mt.sourceMeasure),Ke===0&&state$2.isSpecialBookCategory)for(const Vt of(te=mt.sourceMeasure)==null?void 0:te.TempoExpressions)(ne=Vt==null?void 0:Vt.InstantaneousTempo)!=null&&ne.beatUnit&&(Xe=Vt.InstantaneousTempo.beatUnit);rt=(ie=mt.sourceMeasure)==null?void 0:ie.MeasureNumberXML,ct==((re=mt.sourceMeasure)==null?void 0:re.MeasureNumberXML)?bt++:(ct=(oe=mt.sourceMeasure)==null?void 0:oe.MeasureNumberXML,bt=0);let ri=mt.sourceMeasure.tempoInBPM;const{metronomeNoteIndex:ui}=Ee.currentMeasure;ui!==0&&ui>Ke&&(ri=((le=D[D.length-1])==null?void 0:le.speed)||100);const Zt=[(fe=mt.sourceMeasure.verticalMeasureList)==null?void 0:fe[0]],{realValue:$i}=Ee.currentTimeStamp,{RealValue:yi,Denominator:Wt}=formatDuration(Ee.currentMeasure.activeTimeSignature,Ee.currentMeasure.duration);let{wholeValue:Ki,numerator:an,denominator:ln,realValue:Qn}=mt.length,Zi=He,zi=(state$2.isSpecialBookCategory?getTimeByBeatUnit(Xe,ri,Ee.currentMeasure.activeTimeSignature.Denominator):W)||1,pn=(state$2.isSpecialBookCategory?ri:W)||1;je===0&&(F+=getFixTime(zi));let Ti=(an===0&&mt.isRestFlag?yi:(Ki+an)/ln)*Wt*(60/zi);const cn=yi*Wt*(60/zi);["Piano"].includes((he=state$2.activeDetail)==null?void 0:he.code)&&(Ti=(Ee.currentTimeStamp.realValue-wt||(an===0?yi:(Ki+an)/ln))*Wt*(60/zi)),mt.isRestFlag&&((ge=mt==null?void 0:mt.sourceMeasure)==null?void 0:ge.allRests)&&(xt=(ce=mt==null?void 0:mt.sourceMeasure)==null?void 0:ce.multipleRestMeasures),xt>0&&(xt-=1,Ti=cn),mt.isRestFlag&&Ti>cn&&(Ti=cn),mt.DotsXml&&mt.tuplet&&(Ti=Ti*1.5),st&&(Ti=1e-7,st=!1,Kt=!0);const ws=(me=mt.sourceMeasure.staffLinkedExpressions)==null?void 0:me[0];for(const Vt of ws||[])if(Vt&&((ye=Vt.expressions)==null?void 0:ye.find(Fn=>Fn.label==="\u8DF3\u8FC7\u4E0B\u4E00\u4E2A"))&&Fraction$1.Equal((ve=mt.voiceEntry)==null?void 0:ve.Timestamp,Vt.Timestamp)){st=!0;break}wt=Ee.currentTimeStamp.realValue,He+=Ti,Qe+=Ti;let Tn=Ti+Zi;const es=mt.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0,mi=(be=(pe=Zt[0])==null?void 0:pe.vfVoices["1"])==null?void 0:be.tickables[bt];if(D.length&&D[D.length-1].relativeTime===Zi)continue;if(je===0){const Vt=getMeasureDurationDiff(Ee.currentMeasure);console.log("diff",Vt),Vt>0&&(tt=Vt*Wt*(60/zi),((xe=state$2.activeDetail)==null?void 0:xe.audioType)==="MIDI"&&(tt=0),F+=tt)}const vi={skipMode:Kt,NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId,cursorBox:$t,skipNextNote:st,measureNumberPrinted:rt,difftime:tt,octaveOffset:(ue=Zt[0])==null?void 0:ue.octaveOffset,frequency:(_e=mt.pitch)==null?void 0:_e.frequency,speed:pn,beatSpeed:zi,i:je,si:Ke,stepSpeeds:Fe,indexOfMeasures:dt,measureOpenIndex:U.length-1,measures:Oe,tempoInBPM:mt.sourceMeasure.tempoInBPM,measureLength:cn,relaMeasureLength:Qe,id:mi==null?void 0:mi.attrs.id,note:mt.halfTone+12,relativeTime:retain(Zi),time:retain(Zi+F),endtime:retain(Tn+F),relaEndtime:retain(Tn),realValue:$i,halfTone:mt.halfTone,voiceEntry:{isStaccato:mt.voiceEntry.isStaccato(),Timestamp:{...mt.voiceEntry.Timestamp},ornamentContainer:mt.voiceEntry.ornamentContainer?{...mt.voiceEntry.ornamentContainer}:""},noteElement:{NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId,notehead:mt.notehead?{filled:mt.notehead.filled,shape:mt.notehead.shape,sourceNote:(Be=mt.notehead.sourceNote)==null?void 0:Be.NoteToGraphicalNoteObjectId}:"",noteheadColor:mt.noteheadColor,isRestFlag:mt.isRestFlag,sourceMeasure:{measureListIndex:(Ae=mt==null?void 0:mt.SourceMeasure)==null?void 0:Ae.measureListIndex,MeasureNumberXML:(Pe=mt==null?void 0:mt.SourceMeasure)==null?void 0:Pe.MeasureNumberXML,allRests:(Ie=mt==null?void 0:mt.SourceMeasure)==null?void 0:Ie.allRests,isRestFlag:(Ce=mt==null?void 0:mt.SourceMeasure)==null?void 0:Ce.isRestFlag,multipleRestMeasures:(Te=mt==null?void 0:mt.SourceMeasure)==null?void 0:Te.multipleRestMeasures,verticalMeasureList:Array.isArray((Se=mt==null?void 0:mt.SourceMeasure)==null?void 0:Se.verticalMeasureList)?mt.SourceMeasure.verticalMeasureList.map(Vt=>{const{x:is,y:Fn,width:ns,height:Es,start_x:Fi,end_x:Ts}=(Vt==null?void 0:Vt.stave)||{};return Vt?{stave:{x:is,y:Fn,width:ns,height:Es,start_x:Fi,end_x:Ts},boundingBox:Vt&&Vt.boundingBox?{absolutePosition:{...Vt.boundingBox.absolutePosition},size:{...Vt.boundingBox.size}}:""}:void 0}):[],activeTimeSignature:{...mt.activeTimeSignature}},tie:mt.tie?{StartNote:{NoteToGraphicalNoteObjectId:mt.tie.StartNote.NoteToGraphicalNoteObjectId},notes:Array.isArray(mt.tie.notes)&&((Ne=mt.tie.notes)==null?void 0:Ne.map(Vt=>({NoteToGraphicalNoteObjectId:Vt.NoteToGraphicalNoteObjectId})))||[]}:"",slurs:Array.isArray(mt.slurs)?mt.slurs.map(Vt=>({startNote:{NoteToGraphicalNoteObjectId:Vt.startNote.NoteToGraphicalNoteObjectId},endNote:{NoteToGraphicalNoteObjectId:Vt.endNote.NoteToGraphicalNoteObjectId}})):[],pitch:{prevFrequency:(Ge=mt.pitch)==null?void 0:Ge.prevFrequency,nextFrequency:(ke=mt.pitch)==null?void 0:ke.nextFrequency,frequency:($e=mt.pitch)==null?void 0:$e.frequency},Length:{...mt.Length}},svgElelent:mi?{bbox:((We=mi.getBoundingBox)==null?void 0:We.call(mi))||"",top_y:mi.top_y,note_height:mi.note_height}:"",fixedKey:es,realKey:0,duration:0,formatLyricsEntries:formatLyricsEntries(mt),stave:Zt[0]&&Zt[0].stave?{attrs:Zt[0].stave?{...Zt[0].stave.attrs}:{}}:"",firstVerticalMeasure:{measureNumber:(Ve=Zt==null?void 0:Zt[0])==null?void 0:Ve.measureNumber},noteLength:1,halfTone1:Array.isArray(Qt.notes)?Qt.notes.map(Vt=>Vt.halfTone+12).filter(Boolean):[],halfTone2:Ot&&Array.isArray(Ot.notes)?Ot.notes.map(Vt=>Vt.halfTone+12).filter(Boolean):[]};vi.realKey=q(mt.halfTone-es*12,vi),vi.duration=vi.endtime-vi.time;const ts=((et=(qe=Zt[0])==null?void 0:qe.vfVoices["1"])==null?void 0:et.tickables)||[],Ui=((lt=(ft=(ot=mt.sourceMeasure.verticalMeasureList)==null?void 0:ot[0])==null?void 0:ft.staffEntries)==null?void 0:lt.length)||ts.length;vi.noteLength=Ui||1,D.push(vi),G.push(vi.id),Oe.push({realKey:vi.realKey,NoteToGraphicalNoteObjectId:mt.NoteToGraphicalNoteObjectId}),KeEe.relativeTime-je.relativeTime).map((Ee,je)=>({...Ee,i:je}));for(let Ee=0;Ee{if(B.product){if(R||R===0)if(F&&R-F===1)B.cursor.setPosition({...state$2.times[R].cursorBox});else if(F&&R-F>0)for(;R-F>0;)F++,R-F>0&&B.cursor.setPosition({...state$2.times[F].cursorBox});else B.cursor.setPosition({...state$2.times[R].cursorBox})}else if(R||R===0)if(F&&R-F===1)B.cursor.next();else if(F&&R-F>0)for(;R-F>0;)F++,B.cursor.next();else{let D=0;for(B.cursor.reset();D{if(R>state$2.times[state$2.times.length-1].endtime)return-1;let F=0;const D=B.filter((G,U)=>{const W=B[U-1];return(W==null?void 0:W.skipNextNote)===!1});for(let G=0;G=U.time)(!W||U.time!=W.time)&&(F=U.i);else break}if(state$2.sectionStatus&&state$2.section.length===2){const G=state$2.befireSection||state$2.section[0];F=Math.min(Math.max(F,G.i),state$2.section[1].i),console.log("endIndex",F)}return F},getSlursNote=(B,R)=>{var D,G;let F=R==="end"?(D=B.noteElement.slurs[0])==null?void 0:D.endNote:(G=B.noteElement.slurs[0])==null?void 0:G.startNote;if(!!F)return state$2.times.find(U=>U.NoteToGraphicalNoteObjectId==F.NoteToGraphicalNoteObjectId)},getNoteBySlursStart=(B,R,F)=>{let D=B,G=getSlursNote(D,F);if(!G&&R)for(const U of D.measures){const W=state$2.times.find(q=>q.NoteToGraphicalNoteObjectId==U.NoteToGraphicalNoteObjectId);console.log("\u{1F680} ~ item",W),W.noteElement.slurs.length&&(G=getSlursNote(W,F),D=W)}if(D&&G!==D.noteElement){for(const U of state$2.times)if(G===U.noteElement)return U}return D},getParentNote=B=>{let R;if(B){for(const F of state$2.times)if(B.NoteToGraphicalNoteObjectId===F.noteElement.NoteToGraphicalNoteObjectId)return F}return R},getNoteByMeasuresSlursStart=B=>{let R=B,F;if(B.noteElement.tie&&B.noteElement.tie.StartNote&&(F=B.noteElement.tie.StartNote),R&&F&&F!==R.noteElement){for(const D of state$2.times)if(F.NoteToGraphicalNoteObjectId===D.noteElement.NoteToGraphicalNoteObjectId)return D}return R},getActtiveNoteByTimes=B=>{var G;const R=(G=B.target)==null?void 0:G.dataset,F={};for(const U of state$2.times)U.id&&(F[U.id]=U);return F[R.id||""]},getPrevHasSourceNote=B=>{const R=Math.max(state$2.times.indexOf(B)-1,0);for(let F=R;F>=0;F--){const D=state$2.times[F];if(D!=null&&D.stave)return D}},getBoundingBoxByverticalNote=B=>{var D,G,U,W,q,Y,K,Z,j;let R=(G=(D=B==null?void 0:B.noteElement)==null?void 0:D.sourceMeasure)==null?void 0:G.verticalMeasureList;R=!R||!R[0]?((U=B==null?void 0:B.noteElement)==null?void 0:U.isRestFlag)&&((Y=(q=(W=getPrevHasSourceNote(B))==null?void 0:W.noteElement)==null?void 0:q.sourceMeasure)==null?void 0:Y.verticalMeasureList):R;let F=0;if(R){const Q=R[state.partIndex];for(let J=0;J0&&(F+=(K=R[J-1])==null?void 0:K.stave.height),F+=ne;const{x:ie,y:re,width:oe,context:le,start_x:fe,end_x:he}=Q==null?void 0:Q.stave;return{measureIndex:((Z=B==null?void 0:B.noteElement)==null?void 0:Z.sourceMeasure.measureListIndex)||0,MeasureNumberXML:((j=B==null?void 0:B.noteElement)==null?void 0:j.sourceMeasure.MeasureNumberXML)||1,start_x:fe,end_x:he,height:F,x:ie,y:re,width:oe,context:le}}}}return{measureIndex:0,height:F,start_x:0,end_x:0,x:0,y:0,width:0,context:{element:null}}},getDuration=B=>{var R;if(B){const F=(R=B==null?void 0:B.graphic)==null?void 0:R.measureList[0][0];if(F){const{duration:D,tempoInBPM:G,activeTimeSignature:U}=F==null?void 0:F.parentSourceMeasure;if(D)return{...formatDuration(U),tempoInBPM:G}}}return{}},formatDuration=(B,R)=>B,getTimeByBeatUnit=(B,R,F)=>{let D=4;switch(B){case"1024th":D=1024;break;case"512th":D=512;break;case"256th":D=256;break;case"128th":D=128;break;case"64th":D=64;break;case"32nd":D=32;break;case"16th":D=16;break;case"eighth":D=8;break;case"quarter":D=4;break;case"half":D=2;break;case"whole":D=1;break;case"breve":D=.5;break;case"long":D=.25;break;case"maxima":D=.125;break}return F/D*R},getEnvHostname=()=>location.origin.indexOf("online")>-1?"https://mstuonline.dayaedu.com":location.origin.indexOf("dev")>-1?"http://mstudev.dayaedu.com":"https://mstutest.dayaedu.com",getTvIconUrl=()=>location.origin.indexOf("online")>-1?"https://mteaonline.dayaedu.com/#/guide":location.origin.indexOf("dev")>-1?"http://mteadev.dayaedu.com/#/guide":"https://mteatest.dayaedu.com/#/guide",setPrefix=B=>B?"?"+B:"",formatXML=(B,R)=>{var Y,K,Z;if(!B)return"";const F=new DOMParser().parseFromString(B,"text/xml"),D=F.getElementsByTagName("measure");let G=-1,U=-1;const W=document.createElement("direction"),q=` quarter 100 1 1`;W.innerHTML=q,F.getElementsByTagName("per-minute").length===0&&((Y=D[0])==null||Y.insertAdjacentElement("afterbegin",W));for(const j of D){G===-1&&j.getElementsByTagName("beats").length&&(G=parseInt(j.getElementsByTagName("beats")[0].textContent||"4")),U===-1&&j.getElementsByTagName("beat-type").length&&(U=parseInt(j.getElementsByTagName("beat-type")[0].textContent||"4"));const Q=parseInt(((K=j.getElementsByTagName("divisions")[0])==null?void 0:K.textContent)||"256");if(j.getElementsByTagName("note").length===0){const J=(Z=j.getElementsByTagName("forward")[0])==null?void 0:Z.getElementsByTagName("duration")[0];J&&(J.textContent="0"),j.innerHTML=j.innerHTML+` ${Q*G} 1 whole `}}if(R){const j=F.querySelector("work-title");j&&R.title&&(j.textContent=R.title)}return new XMLSerializer().serializeToString(F)},getCustomInfo=B=>{var G,U,W;const R={showSpeed:!0,parsedXML:B,code:""},F=new DOMParser().parseFromString(B,"text/xml"),D=F.getElementsByTagName("words");for(const q of D)q&&((G=q.textContent)==null?void 0:G.trim())==="\u9690\u85CF\u901F\u5EA6"&&(R.showSpeed=!1,q.textContent=""),q&&((U=q.textContent)==null?void 0:U.trim())==="@"&&(q.textContent="segno");return R.parsedXML=new XMLSerializer().serializeToString(F),R.code=((W=F.querySelector("part-name"))==null?void 0:W.innerHTML)||"",R},setElementNoteBefore=(B,R,F)=>{let D=0;if(!!R){for(let G=0;G0){let G=0;for(let U=0;U{if(B){const R=B.toLocaleLowerCase(),F="d\\s?\\.s\\.",D="d\\.\\s?c\\.";return R==="@"||StringUtil.StringContainsSeparatedWord(R,F+" al fine",!0)||StringUtil.StringContainsSeparatedWord(R,F+" al coda",!0)||StringUtil.StringContainsSeparatedWord(R,D+" al fine",!0)||StringUtil.StringContainsSeparatedWord(R,D+" al coda",!0)||StringUtil.StringContainsSeparatedWord(R,D)||StringUtil.StringContainsSeparatedWord(R,"da\\s?capo",!0)||StringUtil.StringContainsSeparatedWord(R,F,!0)||StringUtil.StringContainsSeparatedWord(R,"dal\\s?segno",!0)||StringUtil.StringContainsSeparatedWord(R,"al\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(R,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(R,"a (la )?coda",!0)||StringUtil.StringContainsSeparatedWord(R,"fine",!0)||StringUtil.StringContainsSeparatedWord(R,"coda",!0)||StringUtil.StringContainsSeparatedWord(R,"segno",!0)}return!1},onlyVisible=(B,R)=>{var j,Q,J,te,ne,ie;if(!B)return"";const F=new DOMParser().parseFromString(B,"text/xml"),D=((Q=(j=F.getElementsByTagName("part-list"))==null?void 0:j[0])==null?void 0:Q.getElementsByTagName("score-part"))||[],G=Array.from(D).map(re=>{var oe;return((oe=re.getElementsByTagName("part-name"))==null?void 0:oe[0].textContent)||""}),U=F.getElementsByTagName("part")||[];if(!U.length)return"";const W=[...(J=U[0])==null?void 0:J.getElementsByTagName("measure")],q=[...(te=U[0])==null?void 0:te.getElementsByTagName("metronome")],Y=[...(ne=U[0])==null?void 0:ne.getElementsByTagName("words")],K=[...(ie=U[0])==null?void 0:ie.getElementsByTagName("rehearsal")],Z=D[R];if(state$2.partListNames=G,Z){const re=Z.getAttribute("id");Array.from(U).forEach(fe=>{var he,ge,ce,me,ye;if(fe&&fe.getAttribute("id")!==re)(he=fe.parentNode)==null||he.removeChild(fe);else if(fe&&fe.getAttribute("id")!=="P1"){const ve={};for(let pe=0;pe{var Be;const be=(Be=pe.parentElement)==null?void 0:Be.parentElement,xe=be==null?void 0:be.parentElement,ue=[...(xe==null?void 0:xe.childNodes)||[]],_e=be?ue.indexOf(be):-1;if(xe&&_e>-1){const Ae=W.indexOf(xe),Pe=fe.getElementsByTagName("measure")[Ae];setElementNoteBefore(be,xe,Pe)}}),Y.forEach(pe=>{var xe;const be=pe.textContent||"";if((isSpecialMark(be)||isSpeedKeyword(be)||isGradientWords(be)||isRepeatWord(be)||GRADIENT_SPEED_RESET_TAG)&&be){const ue=(xe=pe.parentElement)==null?void 0:xe.parentElement,_e=ue==null?void 0:ue.parentElement,Be=[...(_e==null?void 0:_e.childNodes)||[]],Ae=ue?Be.indexOf(ue):-1;if(ue&&_e&&Ae>-1){const Pe=W.indexOf(_e),Ie=fe.getElementsByTagName("measure")[Pe];setElementNoteBefore(ue,_e,Ie)}}}),K.forEach(pe=>{var ue,_e;const be=(ue=pe.parentElement)==null?void 0:ue.parentElement,xe=be==null?void 0:be.parentElement;if(xe){const Be=W.indexOf(xe);(_e=fe.getElementsByTagName("measure")[Be])==null||_e.appendChild(be.cloneNode(!0))}})}if(fe&&fe.getAttribute("id")===re){const ve=fe.getElementsByTagName("barline"),pe=(me=ve[ve.length-1])==null?void 0:me.parentElement;if(((ye=pe==null?void 0:pe.lastElementChild)==null?void 0:ye.tagName)!=="barline"){const be=(pe==null?void 0:pe.children)||[];for(let xe of be)if(xe.tagName==="barline"){pe==null||pe.appendChild(xe);break}}}}),Array.from(D).forEach(fe=>{var he;fe&&fe.getAttribute("id")!==re&&((he=fe.parentNode)==null||he.removeChild(fe))});const oe=F.getElementsByTagName("note"),le=fe=>{var ce;let he=oe[fe+1];for(let me=fe;me{var ce;const ge=fe.getElementsByTagName("grace");ge&&ge.length&&fe.appendChild((ce=le(he))==null?void 0:ce.cloneNode(!0))})}return new XMLSerializer().serializeToString(F)},appoggianceFormate=B=>{var G,U,W,q;if(!B)return B;const R=new DOMParser().parseFromString(B,"text/xml"),F=R.querySelectorAll("grace");if(!F.length)return B;const D=Y=>Y.querySelector("grace")?D(Y==null?void 0:Y.nextElementSibling):Y;for(let Y of F){const K=(G=Y.parentElement)==null?void 0:G.querySelector("notations");if(K&&K.querySelectorAll("slur").length>1){let Z=D((U=Y.parentElement)==null?void 0:U.nextElementSibling);if(Z&&Z.querySelectorAll("slur").length>0){const j=Array.from(((W=Z.querySelector("notations"))==null?void 0:W.children)||[]).map(J=>J.getAttribute("number")),Q=K.querySelectorAll("slur");for(let J of Q)j.includes(J.getAttribute("number"))||(q=Z.querySelector("notations"))==null||q.appendChild(J)}}}return new XMLSerializer().serializeToString(R)},getVoicePartInfo=()=>{const{MusicalInstrumentClassification:B,chinesePartName:R}=state$3;let F=-1;const{partListNames:D,partIndex:G}=state$2;if(D.filter(W=>(W||"").trim()!=="").length)for(const W of Object.entries(B)){const[q,Y]=W,K=D[G],Z=Y.filter(j=>j&&K.indexOf(j||"")>-1);if(K&&(Z.length||Y.includes(K)))return isNaN(+q)||(F=+q),{realPartListNames:D,subjectId:F,partListNames:Y,partName:K,chinesePartName:R[K]||K}}return{subjectId:F,partListNames:[]}},classids=[1,30],idIsInClassIds=(B,R,F=!1)=>{if(!B)return!1;let D=!1;for(const G of B){if(G.id===R&&(F||classids.includes(G.id))){D=!0;break}if(G.sysMusicScoreCategoriesList&&(D=idIsInClassIds(G.sysMusicScoreCategoriesList,R,F||classids.includes(G.id)),D))break}return D};class SectionHint{constructor(){this.currentNote=null,this.el=document.createElement("div"),this.span=document.createElement("span"),this.init()}init(){this.el.id="section-hint"+Math.floor(Math.random()*1e5),this.hide()}showForElement(R){var G;if(this.currentNote===R)return;this.el||(this.el=document.createElement("div"),this.init(),this.show()),this.currentNote=R;const F=getBoundingBoxByverticalNote(R),D=document.querySelector("#osmdSvgPage1");if(F){const{x:U,y:W,width:q,height:Y}=F;this.el.id="custom-cursor-bg-hint",this.el.style.position="absolute",this.el.style.top=formatZoom(W)+"px",this.el.style.left=formatZoom(U)+"px",this.el.style.width=formatZoom(q)+"px",this.el.style.height=formatZoom(Y)+"px",this.el.style.zIndex="-1",(G=D==null?void 0:D.parentNode)==null||G.appendChild(this.el)}}hide(){this.el.style.display="none"}show(){this.el.style.display=""}destroy(){this.currentNote=null,this.hide()}}function __variableDynamicImportRuntime0__(B){switch(B){case"../src/pages/baseClass/index.tsx":return __vitePreload(()=>import("./index.101a4d3f.js"),["assets/index.101a4d3f.js","assets/index.4b7cbd62.css","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.dc7854b3.js","assets/index.c0efa7c1.js","assets/index.f99eab56.js"]);case"../src/pages/classify/index.tsx":return __vitePreload(()=>import("./index.d43e3db1.js"),["assets/index.d43e3db1.js","assets/index.f442919d.css","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.c0efa7c1.js","assets/index.dc7854b3.js"]);case"../src/pages/detail/index.tsx":return __vitePreload(()=>import("./index.ccb4fb32.js"),["assets/index.ccb4fb32.js","assets/index.b8ab8b80.css","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.e570d0f5.js","assets/index.dc7854b3.js","assets/index.c0efa7c1.js","assets/index.430712b9.js","assets/index.93438080.css","assets/index.42ac9a18.js","assets/index.06f6a16d.css","assets/music.b35eb5be.js","assets/state.f2d5ac9e.js","assets/vip.f2ffbf3e.js","assets/vip.838f4afe.css","assets/index.47284677.js","assets/index.931899c3.js","assets/index.f99eab56.js"]);case"../src/pages/list/index.tsx":return __vitePreload(()=>import("./index.065a2149.js"),["assets/index.065a2149.js","assets/index.be7ceb5d.css","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/state.f2d5ac9e.js","assets/vip.f2ffbf3e.js","assets/vip.838f4afe.css","assets/index.dc7854b3.js","assets/music.b35eb5be.js","assets/index.47284677.js","assets/index.f99eab56.js"]);case"../src/pages/notfund/index.tsx":return __vitePreload(()=>import("./index.d25609b4.js"),["assets/index.d25609b4.js","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.f99eab56.js","assets/index.dc7854b3.js"]);case"../src/pages/render-test/index.tsx":return __vitePreload(()=>import("./index.63565a32.js"),["assets/index.63565a32.js","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.dc7854b3.js"]);case"../src/pages/report/index.tsx":return __vitePreload(()=>import("./index.c2db1581.js").then(function(R){return R.i}),["assets/index.c2db1581.js","assets/index.007e2b62.css","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.42ac9a18.js","assets/index.06f6a16d.css","assets/music.b35eb5be.js","assets/index.dc7854b3.js","assets/index.dc9b946d.js","assets/index.fba0bdd7.css","assets/index.e570d0f5.js","assets/index.f99eab56.js","assets/index.931899c3.js"]);default:return new Promise(function(R,F){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(F.bind(null,new Error("Unknown variable dynamic import: "+B)))})}}const getRouterComponent=B=>async()=>{const R=setTimeout(()=>{open$1()},300);let F=Promise.resolve(null);try{F=await __variableDynamicImportRuntime0__(`../src/pages/${B}/index.tsx`)}catch{F=Promise.reject()}return clearTimeout(R),close$1(),F};var routes=[{path:"/",component:getRouterComponent("baseClass")},{path:"/classify",component:getRouterComponent("classify")},{path:"/list/:id",component:getRouterComponent("list"),meta:{keepAlive:!0}},{path:"/detail/:id",component:getRouterComponent("detail")},{path:"/evaluating/:id",component:getRouterComponent("detail")},{path:"/report",component:getRouterComponent("report")},{path:"/report/:id",component:getRouterComponent("report")},{path:"/render-test",component:getRouterComponent("render-test")},{path:"/vexflow-test",component:__vitePreload(()=>import("./index.ca62b4cf.js"),["assets/index.ca62b4cf.js","assets/native-message.761fd015.js","assets/native-message.f33c5af8.css","assets/index.dc7854b3.js"])},{path:"/:pathMatch(.*)*",component:getRouterComponent("notfund"),meta:{title:"404 Not Fund"}}];createRouter({history:createWebHashHistory(),routes});const tock="SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAGAAAKmwA6Ojo6Ojo6Ojo6Ojo6Ojo6YmJiYmJiYmJiYmJiYmJiYmKJiYmJiYmJiYmJiYmJiYmJsbGxsbGxsbGxsbGxsbGxsbHY2NjY2NjY2NjY2NjY2NjY2P////////////////////8AAAAATGF2YzU4LjU0AAAAAAAAAAAAAAAAJAQUAAAAAAAACpv9GcQ9AAAAAAAAAAAAAAAAAAAAAP/7kGQAAALJHFAdPeAAMs13wKAUABOVWUYZ2gAA1UIigwBQAAAAUlDQQxklOcnZOydj1iYIxFj1oWbgRwYhdwAgBMLA1q+Ech0QS2HREhx5GBklTjJq98QImWB5q9/SmXkQa8gJAxrBDlDn/l/D5d9cH9pd/D/Ln+H+XP8P////////////kIQhCf6EIz////5z8hCf//////85CEqc5zkqcPh8Ph8DgAAAABwOBwUIYigkYzAOBgVYUoT0xxC8ypKoLAmYGA34OAo4Ukoel04PoEw+AY5KXwIIcD4SwNeeCwQnPAyAEDKEQAQwphNGfC10AQCF6hESOSROeGNRFBPYnkVxbUW+KTH8ZQZcmyCUWWj/HPJ8iBBy2SxPrRrRr/lYqlcnidNieLpsuvXr/5eMTIvHThkdMDIz///8wUmYIJoIHzRj6ALf/8Ahz/////////////09fPP/f++v91/qp///0FCCor/MeqOQV9OtjKwvETiP///4gLFJ///+PYKZAAAJSMgAAwRYCBMBIAIRYAFgJiRgCoBwYDiBGGAvgP/7kmQPjfQJHkZXfqAANq14YOAUAE0JqxIN/oiIvTZhgACj2SxgDYAkYBOAeGAtgzRh5IwEZAKX5HH4nhRqcw/qYc4EGmBlAeBgu4K8BuRvgZYEQGQRwBjkZDiS0cxRbUuZOZHpixkiipJJ1OpaqzJIe4kJfb////////6heitNxprnDpIJ//////////+/r+tfuy37W7+d1rTu37oi36V//p/RGntSvLdowxnDgeONKh1jhpihwTMDCAwcPO8CRICfmLS0OAAxDCIU1kuNRoDAEATswDwKMME9IWzYyOJsxDwZfMBUCPDAYwSEwHACiA8jwD2hwLkAGpwxG//9///t/q//////7+////+r/////99mu7qqdT6Dp6KtS3WmpaJso5oG//zU/y9j4VkE5l+sBkvmkX+v///acWnV2trA0mrZlJKphkD4zD4UYeaLigSkDKVVAAAABoOjRLAYlW2pbW0TjAQPMMiYxoNTLhlNAqA29QTCARHAylZ+yMpzCeDB0ANUwLUBKIgHkGugOHwNbgAFkXS1+v/V/p/6/9f+3/7/+5JkJojzkmvFa5+akiqtWGAAJfZPNa0MDn6KSMy2IUAAm6HV66am7/9qv9JO3S/1f/7dPr7V1/1/QrqtqWt9StPTTTSQrNUm/8ud1+NUvMOdbX4+j4aaz6f//rVfa9U1dtasIILnUYQ4o4wTDo87xIDzyBiBbaW9wIQKKCAVG5gEUGSwkaiBx005mGcAmRt6ItsZhME5GFGgZpglAD8YFGA6gce2BpnwGLRgAECDP//6////////11dkWu1S67La+tnr2t1UPo9f1vt//71alvXrqRmSlo60EkkVLTdzxdQLhmeLyRqo+ZmhaOQf9f/FXojkaky22YJvJz9bAcF9zk0p8v/+X752Zmbu+7Tqr5l8j+aexVdmLCHIEz0WejhSGgDmLY5Yp0A4ATFgDgwCcAEMAVATgCBZmAuAwRgoIoKaUNEAmBeh/5rCvGZViZSMxjwUGPQOGEgiDcJ////3/////+/9P0k8taNNRqKfI7qhlYqGY7/ZPyVb9v+vfVDEkVkKZHrOwgVhUUQa6iRRrChlDwrFFDwkOFwoTKKEfr/5//uSZECP8/BswoP8KyAurYhgACb2TnWxCg38qoi3NiGAAJvZyyeZe+GTlsyDkIzns5w///+v+3z/7fmPsPpsRc5J09lTsJmEllkDIC0CMKkQLax/q7iyphogZAOmcI5pr0cF/mCYhxRiJDJgY4CESGCQAW5gMoCIYAgAAg0AAMAMABzABwAAtiH///////////911rt5im0a6NR1t6satH2VVWyp1///+nofRUZHQimYpSmHWZw8cYoTYCDxgmIi6CqIv/TvkZdRYEQDg7m7Uuyzf0qz//////63ds8PL1uNTm7nWYRtHt0hJrgT3SKaqWg5c/2AGAUAwBgATARAbMDQCwwIASzEfGVMWUpU75zHTcSLAMIYFQweADDBFAnA4/AWYG2ABAMv//////////9er32U7V2vruldDdWvVZaqkEXe9f7W/+/f60ek6DpqVRQSRSpsiipA4UCfNjExMjxoXlLSNCZMhf//////////9P/17cln97tv9GIhOVro9PTf//9U19ao0qO5FTUGEDmO4CcoYUgyiwoZVQEcAAABCv/7kmRYgAPBbEKFemACNK14YKAIAB2aEQc56gAB1UIgwwLQAAgAAAABq3tm9gKW2Bgcic+KisAoBQwGBTT7kslMXcNU7Q9oDDGDANzjkkwCwpVFWbApcBEnr8DMCgNMCE59VTQbwB2hOINj//cBpGKiDY+IJl7q/XKgLABYguYC9hbW6aCaDKrUggkLIHoiIpcLljtEEzdNEwm6RspVN3OJUxcZeMBMCJCCAcYbjMGiZcVUZou6LGa1F51prqLxBSDh9yqKXGTYzGwRJSqjk1L54rn0Cbm2szRPolE4R5Ml0dBDyDi4BPh8cDonxH5OiAZLmQ5pOE2RcZwfJc////LY1Y2////xzRDBpCyP1/////////79v9F0GWupdNNadM2SZSe7TWdQOJUETFkEzdRmgYWTc6by8q9lsaGi2UZLWihMzVdaJ916OiZFBiSYpmJwiDHFxdJB0zp4vmRgiS8fmR0UWXJpqRROx6l00HsO4Lr///+PY6MUMf///5ONCIOekEgAFo2Hw+Gw1EYYCAHPFMMT2N4KpAjHDGwyfhUkKHP/+5JkEAAEs0PYbkMkhDDs+DDAHAAAAAGkHAAAIAAANIOAAARJeX/IDTYPBUSlUNQD/+eBQG8NtczGGFOFF6L//zBYBCY0cDrhKStLnRiNT///LXqrpGMbRVUuksRopVlS////p8LMTDUAXkvl1pqtnzWVX////5dRRunlFeU005/7///9f/////3reGruVrlsHP/iUgZCDTTzlv//////zf/+qt//+x1HNHnGv//6OOqz0Op////ORzh4qUHiTiMM/////kABRAf/+qpMQU1FMy4xMDCqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",tick="SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAGAAAKmwA6Ojo6Ojo6Ojo6Ojo6Ojo6YmJiYmJiYmJiYmJiYmJiYmKJiYmJiYmJiYmJiYmJiYmJsbGxsbGxsbGxsbGxsbGxsbHY2NjY2NjY2NjY2NjY2NjY2P////////////////////8AAAAATGF2YzU4LjU0AAAAAAAAAAAAAAAAJAQUAAAAAAAACpsJoXZ7AAAAAAAAAAAAAAAAAAAAAP/7kGQAAALmINEVPeAAOA1nwKAUAFJpV1I5moAAxMIiwwAgAAAJdWKyJljOc0zrZ9UpVjOc0ydibhICwL5OzLXhuEsSYKQMBGN7PInFA1lsOiJDj4ePJU4yavfFKXVjzWb+msvIg0/EgY4If/D/E58P7S7+H+X8H+X8H+XeUDH+U///////////////+d/oQjZCEIQjZCEJ85zv/////8hCEI1CEIQhCHExc7oIBwOAGAYBgGAYfD48ACQIWDrWCzEHeEXm6Qvl/frHQSfa7Wyi4qArEA3m2QMdkQDHnDAyqJQROEFN0BhgEgYaCoAIEAWABAi+FrGF/QbVDIQppKJLOeHoisC1jGjOWr/HLJUgBAzMnK2Wv+Rc3KhPny0V1rrXX/KxqfLxqbF4xS169f/LxiZF46cMjpgcT///8wUmggmgg6DHwRPf/6AW//////////////317pa6/09U///7//ndTuIUN/ldtifykKtKygv///41n////DBRxSpwEjjYIBpwgmIASlzATXqOy+0WbkkUn6YKEJjwqmVBma4nxv/7kmQRhvRLLEe/cuAALs14cOAIAE0lqRIPgFVIsjYhgACb2aAtG1x8BggIP4Bg7YQ+BrcLKgBiv4oEBiIYYEBg5oIEBgPYAWBgNQDaBgKACSBgFIBMBgD4AQKTGRrZ1mKB9jFB0mUkkl3S2LyToGyXq6q0FqelU9VR9SYlO/6vXV//2//yvh3ubf/////////////5P/N+V6fauunX+v31//67c+Z2P6ldBAIyshGO5jAhgqiAhHFyGBSAA6Iz801nLGtGX9dpgKAoCADZgD4EgYICFfmCmAjZgcYHAYLCDOGGCDeZ0W0QOY54C9mDtgUxgbgCqYDuASAIB9DAC8VAA0QmU03un0/Ru30/////t6//r/a3UYivlU12BHnIolcGP+p/9YNArFgyKNS7cofI88/////P28923u73DxbZ0lFImJUdrVhd6t8DsRiWCALVe0ttc7rdNLoy5S5QaABGALAKJgJgRkYIKBSGBVASpgcwJ+YOSK7G9ZqIBiYoLgYJQBKmBBgJBgIQBCYA6ABIwqdLCu9Z//bb/v6/pe1q/Zv/+5JkKY/zZWrEA+AVQjHNqFAARvYN8bEOD4C1CL22YUAAm9j/t//+n/tNRX0Y6tRxaOo9DBJFa7WHABUQuuuiX+37brMiv9QRXvqfsaTl7d/X///8/2t147te2ihqbNj6UUiJ7XI3TrhLAVDlhRuiQCzA1nL/3ljS00Ou8iqYAeARGADA1JgYACmYDuAtGBGgcxgeQgqaxkVzmF+Am5gVYDsYCIAbmANgCxgAgACzp/WvQ7l/9Pv/XtW+tNUZ3qzdtG27////678qXQx9dEsIB8p0I4mUcqIZFIIioYcsXg/7rKY4sEx/yskQCv1sODfXqX/fk3bfrN/u97+wUUxZrxqMvrRBxjrHQcDMzkIqHgIZ7H//96ysz0VacYAgApgZiYGEKA4YJgGJgmBPmDGXUfuKWRjeh4GCkCuYDIEhgAAFoCnpk8Cz3P/t7y3vfL1yEvXoldaK/0/N//9fru/QrGFio7EGIRmKzDzlY7g4kHR4sOHD3D5Rhx39lwVz0WozDO36Ye8RGSizLItOzh/+P/1V78uv/F++XnVXODau4y+V//uSZEmP81dsQwPALUIyzZhQACn2C6GzDA8AVQC4NiGAAKPZWbabe2ImyAcS6WJ42uf//+/7eo4SmsYFgWIYEaYEYBhgMgqAAb05CgQTDCCXMBMC4GAGohM9gCckV7v/b3VS6sk6I3Kpcy/k3pXei/p//3//u+y5lkXUOimYQIMHiqoKdzmIEFiVCDf/znuaM4Q1fF52ict/xk/y/////8172vq6sNjqCmui3ZhonD5BHUYMDLiEaeitExf/ZM0JMTADBeIIFgxgDAlAwBA5AwEFKA9IoNAwph4AcCEGoBA8otA5ZPlo+3///////v+pwNTH8GyDFIyKIfORswWXNnSIIDnbM9++/zvHfPFvmHrVupOT56+1XG6XRMNOjlFhkVyQIyMMvy6nrD2uJnhq6JZSI2Nll5SuVhL/v/WH7z3n+eof23Ocu7SuuSyl/Ol3zNs9SB1pxgZNUBASDtc/99+vSbzvsojBvbkVpvmgYKAnAQGOBtCPoBgXBKBgoBUGkiCAYDHwK3Efm6kGTL5fNGWm6jBAzHMJxk01FwuMgg30C//7kmR0BfNla8ICwV3yMw2oUAAp9hRBsQkVmwAIvLYhwoBQAOnQZaaai+n6aboVvUhWaGFNakEGZkLu1SZ+gqmkp3SdGnSUzr2agpV1MhQQUmrst9Vb3W77prrWtearQRubpqRTdZupM0MEDdFZsznETcrEWLRfNDI6mWjYl////////////76/ttT9NE9F+7f27/0///r0rpQt2ucqMVqq6WEkFkERykEwkPItGggAAASKvjNixlEu4N8A55LwruB3AB+uOSUMLDgDjBsI/l05xH44xcgy5ZMWfxySBEsO0idEySX8cwoEecIsTqlOjV+T5XJwmyiUjVaPZX8qlsnDAzMC8XTdVSvX/z5oXzpxE1PmiBmv1alf/mBkYnz5obnTizU2NEDPr/1f//QSm//9YAEAAACRVvkHHeYo4YgA30vCu4GXAAaAuOSUMLDgDgwbCP5dOcQDHGLkGXLJiz+OSQIlh2kTomSS/jmFAjzhFidUp0avyfK5OE2USkarR7K/lUtk4YGZwvF03VUr1/8+XC+dOImp80QM1+rUr/8wMkT/+5JEeoAEI2hHLk5gAIZNCOXJUAAAAAGkHAAAIAAANIOAAAT580L504iamxogn1/Vq//+cSLqf/9aTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",b64toBlob=(B,R="",F=512)=>{const D=atob(B),G=[];for(let W=0;W=0&&j<=1){if(Q._volume=j,Q._muted)return Q;Q.usingWebAudio&&Q.masterGain.gain.setValueAtTime(j,F.ctx.currentTime);for(var J=0;J=0;Q--)j._howls[Q].unload();return j.usingWebAudio&&j.ctx&&typeof j.ctx.close!="undefined"&&(j.ctx.close(),j.ctx=null,Z()),j},codecs:function(j){return(this||F)._codecs[j.replace(/^x-/,"")]},_setup:function(){var j=this||F;if(j.state=j.ctx&&j.ctx.state||"suspended",j._autoSuspend(),!j.usingWebAudio)if(typeof Audio!="undefined")try{var Q=new Audio;typeof Q.oncanplaythrough=="undefined"&&(j._canPlayEvent="canplay")}catch{j.noAudio=!0}else j.noAudio=!0;try{var Q=new Audio;Q.muted&&(j.noAudio=!0)}catch{}return j.noAudio||j._setupCodecs(),j},_setupCodecs:function(){var j=this||F,Q=null;try{Q=typeof Audio!="undefined"?new Audio:null}catch{return j}if(!Q||typeof Q.canPlayType!="function")return j;var J=Q.canPlayType("audio/mpeg;").replace(/^no$/,""),te=j._navigator?j._navigator.userAgent:"",ne=te.match(/OPR\/([0-6].)/g),ie=ne&&parseInt(ne[0].split("/")[1],10)<33,re=te.indexOf("Safari")!==-1&&te.indexOf("Chrome")===-1,oe=te.match(/Version\/(.*?) /),le=re&&oe&&parseInt(oe[1],10)<15;return j._codecs={mp3:!!(!ie&&(J||Q.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!J,opus:!!Q.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!Q.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!Q.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(Q.canPlayType('audio/wav; codecs="1"')||Q.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!Q.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!Q.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(Q.canPlayType("audio/x-m4a;")||Q.canPlayType("audio/m4a;")||Q.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(Q.canPlayType("audio/x-m4b;")||Q.canPlayType("audio/m4b;")||Q.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(Q.canPlayType("audio/x-mp4;")||Q.canPlayType("audio/mp4;")||Q.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!le&&Q.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!le&&Q.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!Q.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(Q.canPlayType("audio/x-flac;")||Q.canPlayType("audio/flac;")).replace(/^no$/,"")},j},_unlockAudio:function(){var j=this||F;if(!(j._audioUnlocked||!j.ctx)){j._audioUnlocked=!1,j.autoUnlock=!1,!j._mobileUnloaded&&j.ctx.sampleRate!==44100&&(j._mobileUnloaded=!0,j.unload()),j._scratchBuffer=j.ctx.createBuffer(1,1,22050);var Q=function(J){for(;j._html5AudioPool.length0?re._seek:J._sprite[j][0]/1e3),fe=Math.max(0,(J._sprite[j][0]+J._sprite[j][1])/1e3-le),he=fe*1e3/Math.abs(re._rate),ge=J._sprite[j][0]/1e3,ce=(J._sprite[j][0]+J._sprite[j][1])/1e3;re._sprite=j,re._ended=!1;var me=function(){re._paused=!1,re._seek=le,re._start=ge,re._stop=ce,re._loop=!!(re._loop||J._sprite[j][2])};if(le>=ce){J._ended(re);return}var ye=re._node;if(J._webAudio){var ve=function(){J._playLock=!1,me(),J._refreshBuffer(re);var ue=re._muted||J._muted?0:re._volume;ye.gain.setValueAtTime(ue,F.ctx.currentTime),re._playStart=F.ctx.currentTime,typeof ye.bufferSource.start=="undefined"?re._loop?ye.bufferSource.noteGrainOn(0,le,86400):ye.bufferSource.noteGrainOn(0,le,fe):re._loop?ye.bufferSource.start(0,le,86400):ye.bufferSource.start(0,le,fe),he!==1/0&&(J._endTimers[re._id]=setTimeout(J._ended.bind(J,re),he)),Q||setTimeout(function(){J._emit("play",re._id),J._loadQueue()},0)};F.state==="running"&&F.ctx.state!=="interrupted"?ve():(J._playLock=!0,J.once("resume",ve),J._clearTimer(re._id))}else{var pe=function(){ye.currentTime=le,ye.muted=re._muted||J._muted||F._muted||ye.muted,ye.volume=re._volume*F.volume(),ye.playbackRate=re._rate;try{var ue=ye.play();if(ue&&typeof Promise!="undefined"&&(ue instanceof Promise||typeof ue.then=="function")?(J._playLock=!0,me(),ue.then(function(){J._playLock=!1,ye._unlocked=!0,Q?J._loadQueue():J._emit("play",re._id)}).catch(function(){J._playLock=!1,J._emit("playerror",re._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),re._ended=!0,re._paused=!0})):Q||(J._playLock=!1,me(),J._emit("play",re._id)),ye.playbackRate=re._rate,ye.paused){J._emit("playerror",re._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}j!=="__default"||re._loop?J._endTimers[re._id]=setTimeout(J._ended.bind(J,re),he):(J._endTimers[re._id]=function(){J._ended(re),ye.removeEventListener("ended",J._endTimers[re._id],!1)},ye.addEventListener("ended",J._endTimers[re._id],!1))}catch(_e){J._emit("playerror",re._id,_e)}};ye.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(ye.src=J._src,ye.load());var be=window&&window.ejecta||!ye.readyState&&F._navigator.isCocoonJS;if(ye.readyState>=3||be)pe();else{J._playLock=!0,J._state="loading";var xe=function(){J._state="loaded",pe(),ye.removeEventListener(F._canPlayEvent,xe,!1)};ye.addEventListener(F._canPlayEvent,xe,!1),J._clearTimer(re._id)}}return re._id},pause:function(j){var Q=this;if(Q._state!=="loaded"||Q._playLock)return Q._queue.push({event:"pause",action:function(){Q.pause(j)}}),Q;for(var J=Q._getSoundIds(j),te=0;te=0?te=parseInt(Q[0],10):J=parseFloat(Q[0])}else Q.length>=2&&(J=parseFloat(Q[0]),te=parseInt(Q[1],10));var re;if(typeof J!="undefined"&&J>=0&&J<=1){if(j._state!=="loaded"||j._playLock)return j._queue.push({event:"volume",action:function(){j.volume.apply(j,Q)}}),j;typeof te=="undefined"&&(j._volume=J),te=j._getSoundIds(te);for(var oe=0;oe0?te/fe:te),ge=Date.now();j._fadeTo=J,j._interval=setInterval(function(){var ce=(Date.now()-ge)/te;ge=Date.now(),oe+=le*ce,oe=Math.round(oe*100)/100,le<0?oe=Math.max(J,oe):oe=Math.min(J,oe),re._webAudio?j._volume=oe:re.volume(oe,j._id,!0),ie&&(re._volume=oe),(JQ&&oe>=J)&&(clearInterval(j._interval),j._interval=null,j._fadeTo=null,re.volume(J,j._id),re._emit("fade",j._id))},he)},_stopFade:function(j){var Q=this,J=Q._soundById(j);return J&&J._interval&&(Q._webAudio&&J._node.gain.cancelScheduledValues(F.ctx.currentTime),clearInterval(J._interval),J._interval=null,Q.volume(J._fadeTo,j),J._fadeTo=null,Q._emit("fade",j)),Q},loop:function(){var j=this,Q=arguments,J,te,ne;if(Q.length===0)return j._loop;if(Q.length===1)if(typeof Q[0]=="boolean")J=Q[0],j._loop=J;else return ne=j._soundById(parseInt(Q[0],10)),ne?ne._loop:!1;else Q.length===2&&(J=Q[0],te=parseInt(Q[1],10));for(var ie=j._getSoundIds(te),re=0;re=0?te=parseInt(Q[0],10):J=parseFloat(Q[0])}else Q.length===2&&(J=parseFloat(Q[0]),te=parseInt(Q[1],10));var re;if(typeof J=="number"){if(j._state!=="loaded"||j._playLock)return j._queue.push({event:"rate",action:function(){j.rate.apply(j,Q)}}),j;typeof te=="undefined"&&(j._rate=J),te=j._getSoundIds(te);for(var oe=0;oe=0?te=parseInt(Q[0],10):j._sounds.length&&(te=j._sounds[0]._id,J=parseFloat(Q[0]))}else Q.length===2&&(J=parseFloat(Q[0]),te=parseInt(Q[1],10));if(typeof te=="undefined")return 0;if(typeof J=="number"&&(j._state!=="loaded"||j._playLock))return j._queue.push({event:"seek",action:function(){j.seek.apply(j,Q)}}),j;var re=j._soundById(te);if(re)if(typeof J=="number"&&J>=0){var oe=j.playing(te);oe&&j.pause(te,!0),re._seek=J,re._ended=!1,j._clearTimer(te),!j._webAudio&&re._node&&!isNaN(re._node.duration)&&(re._node.currentTime=J);var le=function(){oe&&j.play(te,!0),j._emit("seek",te)};if(oe&&!j._webAudio){var fe=function(){j._playLock?setTimeout(fe,0):le()};setTimeout(fe,0)}else le()}else if(j._webAudio){var he=j.playing(te)?F.ctx.currentTime-re._playStart:0,ge=re._rateSeek?re._rateSeek-re._seek:0;return re._seek+(ge+he*Math.abs(re._rate))}else return re._node.currentTime;return j},playing:function(j){var Q=this;if(typeof j=="number"){var J=Q._soundById(j);return J?!J._paused:!1}for(var te=0;te=0&&F._howls.splice(te,1);var ne=!0;for(J=0;J=0){ne=!1;break}return U&&ne&&delete U[j._src],F.noAudio=!1,j._state="unloaded",j._sounds=[],j=null,null},on:function(j,Q,J,te){var ne=this,ie=ne["_on"+j];return typeof Q=="function"&&ie.push(te?{id:J,fn:Q,once:te}:{id:J,fn:Q}),ne},off:function(j,Q,J){var te=this,ne=te["_on"+j],ie=0;if(typeof Q=="number"&&(J=Q,Q=null),Q||J)for(ie=0;ie=0;ie--)(!ne[ie].id||ne[ie].id===Q||j==="load")&&(setTimeout(function(re){re.call(this,Q,J)}.bind(te,ne[ie].fn),0),ne[ie].once&&te.off(j,ne[ie].fn,ne[ie].id));return te._loadQueue(j),te},_loadQueue:function(j){var Q=this;if(Q._queue.length>0){var J=Q._queue[0];J.event===j&&(Q._queue.shift(),Q._loadQueue()),j||J.action()}return Q},_ended:function(j){var Q=this,J=j._sprite;if(!Q._webAudio&&j._node&&!j._node.paused&&!j._node.ended&&j._node.currentTime=0;te--){if(J<=Q)return;j._sounds[te]._ended&&(j._webAudio&&j._sounds[te]._node&&j._sounds[te]._node.disconnect(0),j._sounds.splice(te,1),J--)}}},_getSoundIds:function(j){var Q=this;if(typeof j=="undefined"){for(var J=[],te=0;te=0;if(F._scratchBuffer&&j.bufferSource&&(j.bufferSource.onended=null,j.bufferSource.disconnect(0),J))try{j.bufferSource.buffer=F._scratchBuffer}catch{}return j.bufferSource=null,Q},_clearSound:function(j){var Q=/MSIE |Trident\//.test(F._navigator&&F._navigator.userAgent);Q||(j.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var G=function(j){this._parent=j,this.init()};G.prototype={init:function(){var j=this,Q=j._parent;return j._muted=Q._muted,j._loop=Q._loop,j._volume=Q._volume,j._rate=Q._rate,j._seek=0,j._paused=!0,j._ended=!0,j._sprite="__default",j._id=++F._counter,Q._sounds.push(j),j.create(),j},create:function(){var j=this,Q=j._parent,J=F._muted||j._muted||j._parent._muted?0:j._volume;return Q._webAudio?(j._node=typeof F.ctx.createGain=="undefined"?F.ctx.createGainNode():F.ctx.createGain(),j._node.gain.setValueAtTime(J,F.ctx.currentTime),j._node.paused=!0,j._node.connect(F.masterGain)):F.noAudio||(j._node=F._obtainHtml5Audio(),j._errorFn=j._errorListener.bind(j),j._node.addEventListener("error",j._errorFn,!1),j._loadFn=j._loadListener.bind(j),j._node.addEventListener(F._canPlayEvent,j._loadFn,!1),j._endFn=j._endListener.bind(j),j._node.addEventListener("ended",j._endFn,!1),j._node.src=Q._src,j._node.preload=Q._preload===!0?"auto":Q._preload,j._node.volume=J*F.volume(),j._node.load()),j},reset:function(){var j=this,Q=j._parent;return j._muted=Q._muted,j._loop=Q._loop,j._volume=Q._volume,j._rate=Q._rate,j._seek=0,j._rateSeek=0,j._paused=!0,j._ended=!0,j._sprite="__default",j._id=++F._counter,j},_errorListener:function(){var j=this;j._parent._emit("loaderror",j._id,j._node.error?j._node.error.code:0),j._node.removeEventListener("error",j._errorFn,!1)},_loadListener:function(){var j=this,Q=j._parent;Q._duration=Math.ceil(j._node.duration*10)/10,Object.keys(Q._sprite).length===0&&(Q._sprite={__default:[0,Q._duration*1e3]}),Q._state!=="loaded"&&(Q._state="loaded",Q._emit("load"),Q._loadQueue()),j._node.removeEventListener(F._canPlayEvent,j._loadFn,!1)},_endListener:function(){var j=this,Q=j._parent;Q._duration===1/0&&(Q._duration=Math.ceil(j._node.duration*10)/10,Q._sprite.__default[1]===1/0&&(Q._sprite.__default[1]=Q._duration*1e3),Q._ended(j)),j._node.removeEventListener("ended",j._endFn,!1)}};var U={},W=function(j){var Q=j._src;if(U[Q]){j._duration=U[Q].duration,K(j);return}if(/^data:[^;]+;base64,/.test(Q)){for(var J=atob(Q.split(",")[1]),te=new Uint8Array(J.length),ne=0;ne0?(U[Q._src]=ne,K(Q,ne)):J()};typeof Promise!="undefined"&&F.ctx.decodeAudioData.length===1?F.ctx.decodeAudioData(j).then(te).catch(J):F.ctx.decodeAudioData(j,te,J)},K=function(j,Q){Q&&!j._duration&&(j._duration=Q.duration),Object.keys(j._sprite).length===0&&(j._sprite={__default:[0,j._duration*1e3]}),j._state!=="loaded"&&(j._state="loaded",j._emit("load"),j._loadQueue())},Z=function(){if(!!F.usingWebAudio){try{typeof AudioContext!="undefined"?F.ctx=new AudioContext:typeof webkitAudioContext!="undefined"?F.ctx=new webkitAudioContext:F.usingWebAudio=!1}catch{F.usingWebAudio=!1}F.ctx||(F.usingWebAudio=!1);var j=/iP(hone|od|ad)/.test(F._navigator&&F._navigator.platform),Q=F._navigator&&F._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),J=Q?parseInt(Q[1],10):null;if(j&&J&&J<9){var te=/safari/.test(F._navigator&&F._navigator.userAgent.toLowerCase());F._navigator&&!te&&(F.usingWebAudio=!1)}F.usingWebAudio&&(F.masterGain=typeof F.ctx.createGain=="undefined"?F.ctx.createGainNode():F.ctx.createGain(),F.masterGain.gain.setValueAtTime(F._muted?0:F._volume,F.ctx.currentTime),F.masterGain.connect(F.ctx.destination)),F._setup()}};B.Howler=F,B.Howl=D,typeof commonjsGlobal$1!="undefined"?(commonjsGlobal$1.HowlerGlobal=R,commonjsGlobal$1.Howler=F,commonjsGlobal$1.Howl=D,commonjsGlobal$1.Sound=G):typeof window!="undefined"&&(window.HowlerGlobal=R,window.Howler=F,window.Howl=D,window.Sound=G)})();/*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.2.3 * howlerjs.com * * (c) 2013-2020, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(F){var D=this;if(!D.ctx||!D.ctx.listener)return D;for(var G=D._howls.length-1;G>=0;G--)D._howls[G].stereo(F);return D},HowlerGlobal.prototype.pos=function(F,D,G){var U=this;if(!U.ctx||!U.ctx.listener)return U;if(D=typeof D!="number"?U._pos[1]:D,G=typeof G!="number"?U._pos[2]:G,typeof F=="number")U._pos=[F,D,G],typeof U.ctx.listener.positionX!="undefined"?(U.ctx.listener.positionX.setTargetAtTime(U._pos[0],Howler.ctx.currentTime,.1),U.ctx.listener.positionY.setTargetAtTime(U._pos[1],Howler.ctx.currentTime,.1),U.ctx.listener.positionZ.setTargetAtTime(U._pos[2],Howler.ctx.currentTime,.1)):U.ctx.listener.setPosition(U._pos[0],U._pos[1],U._pos[2]);else return U._pos;return U},HowlerGlobal.prototype.orientation=function(F,D,G,U,W,q){var Y=this;if(!Y.ctx||!Y.ctx.listener)return Y;var K=Y._orientation;if(D=typeof D!="number"?K[1]:D,G=typeof G!="number"?K[2]:G,U=typeof U!="number"?K[3]:U,W=typeof W!="number"?K[4]:W,q=typeof q!="number"?K[5]:q,typeof F=="number")Y._orientation=[F,D,G,U,W,q],typeof Y.ctx.listener.forwardX!="undefined"?(Y.ctx.listener.forwardX.setTargetAtTime(F,Howler.ctx.currentTime,.1),Y.ctx.listener.forwardY.setTargetAtTime(D,Howler.ctx.currentTime,.1),Y.ctx.listener.forwardZ.setTargetAtTime(G,Howler.ctx.currentTime,.1),Y.ctx.listener.upX.setTargetAtTime(U,Howler.ctx.currentTime,.1),Y.ctx.listener.upY.setTargetAtTime(W,Howler.ctx.currentTime,.1),Y.ctx.listener.upZ.setTargetAtTime(q,Howler.ctx.currentTime,.1)):Y.ctx.listener.setOrientation(F,D,G,U,W,q);else return K;return Y},Howl.prototype.init=function(F){return function(D){var G=this;return G._orientation=D.orientation||[1,0,0],G._stereo=D.stereo||null,G._pos=D.pos||null,G._pannerAttr={coneInnerAngle:typeof D.coneInnerAngle!="undefined"?D.coneInnerAngle:360,coneOuterAngle:typeof D.coneOuterAngle!="undefined"?D.coneOuterAngle:360,coneOuterGain:typeof D.coneOuterGain!="undefined"?D.coneOuterGain:0,distanceModel:typeof D.distanceModel!="undefined"?D.distanceModel:"inverse",maxDistance:typeof D.maxDistance!="undefined"?D.maxDistance:1e4,panningModel:typeof D.panningModel!="undefined"?D.panningModel:"HRTF",refDistance:typeof D.refDistance!="undefined"?D.refDistance:1,rolloffFactor:typeof D.rolloffFactor!="undefined"?D.rolloffFactor:1},G._onstereo=D.onstereo?[{fn:D.onstereo}]:[],G._onpos=D.onpos?[{fn:D.onpos}]:[],G._onorientation=D.onorientation?[{fn:D.onorientation}]:[],F.call(this,D)}}(Howl.prototype.init),Howl.prototype.stereo=function(F,D){var G=this;if(!G._webAudio)return G;if(G._state!=="loaded")return G._queue.push({event:"stereo",action:function(){G.stereo(F,D)}}),G;var U=typeof Howler.ctx.createStereoPanner=="undefined"?"spatial":"stereo";if(typeof D=="undefined")if(typeof F=="number")G._stereo=F,G._pos=[F,0,0];else return G._stereo;for(var W=G._getSoundIds(D),q=0;q(browserInfo$4.huawei?.2:.1)/B*1e3;let htick=new howler.Howl({src:tickUrl,format:["mp3"]}),htock=new howler.Howl({src:tockUrl,format:["mp3"]});class Player{constructor(R,F){this.ticks=[],this.event=new EventEmitter,this.isRuning=!1,this.isNeedStop=!1,this.getTickByDots=(D,G)=>Array.from(Array(D)).map((U,W)=>({time:`0:${(G+W)*1.4}`,note:W===0?"C5":"c4",velocity:1,index:W+G})),this.formatTick=(D,G)=>{const U=[];for(let W=0;W{const Y=U%R.length===0?htick:htock;this.isNeedStop||(Y.play(),console.log(Y)),U{var K;this.isRuning=!1,this.event.emit("stop"),console.log("tick stop"),(K=this.part)==null||K.clear()},450/F),U++},q=()=>{this.isNeedStop||setTimeout(()=>{try{W()}catch(Y){console.log("timeTickError",Y)}},700/F)};W()}async setAudioMode(R,F,D=1){if(await nextTick(),this.isRuning)return;this.isRuning=!0;const G=this.formatTick(R,D);this.startTick(G,F,R,D)}async start(R,F,D=1){this.isNeedStop=!1,this.setAudioMode(R,F,D)}destroy(){this.ticks=[],this.event.emit("destroy"),console.log("destroy"),state$2.activeTick=-1,state$2.activeTickRepeat=1,this.event.removeAllListeners(),this.isRuning=!1,this.isNeedStop=!0,this.part&&(this.part.clear(),this.part=null)}}const useOriginSearch=()=>{const B=location.search||location.hash.replaceAll("#/",""),R=queryString.parse(B);if(R.Authorization&&sessionStorage.setItem("Authorization",R.Authorization||""),R.setting)try{R.setting=JSON.parse(decodeURIComponent(R.setting))}catch{}return R},useReload=()=>{const B=useOriginSearch(),R=queryString.stringify({...B,_t:Date.now()},{});location.search="?"+R},useMenu=()=>{const B=ref(!0);return useEventListener("click",R=>{const F=R.path||R.composedPath(),D=F[0];if(D){const G=D.dataset.id&&D.dataset.id.indexOf("auto")>-1,U=F.find(W=>{var q;return W.tagName==="BUTTON"||((q=W.getAttribute)==null?void 0:q.call(W,"role"))==="button"});if(G||U)return}B.value=!B.value},{target:document.body.querySelector("#app")}),watch(()=>state.playState,(R,F)=>{console.log("newRuntime",F);let D=F;D==="suspend"&&(D="pause"),B.value=D!=="pause"}),[B]};var dayjs_min={exports:{}};(function(B,R){(function(F,D){B.exports=D()})(commonjsGlobal$1,function(){var F=1e3,D=6e4,G=36e5,U="millisecond",W="second",q="minute",Y="hour",K="day",Z="week",j="month",Q="quarter",J="year",te="date",ne="Invalid Date",ie=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,re=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,oe={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},le=function(xe,ue,_e){var Be=String(xe);return!Be||Be.length>=ue?xe:""+Array(ue+1-Be.length).join(_e)+xe},fe={s:le,z:function(xe){var ue=-xe.utcOffset(),_e=Math.abs(ue),Be=Math.floor(_e/60),Ae=_e%60;return(ue<=0?"+":"-")+le(Be,2,"0")+":"+le(Ae,2,"0")},m:function xe(ue,_e){if(ue.date()<_e.date())return-xe(_e,ue);var Be=12*(_e.year()-ue.year())+(_e.month()-ue.month()),Ae=ue.clone().add(Be,j),Pe=_e-Ae<0,Ie=ue.clone().add(Be+(Pe?-1:1),j);return+(-(Be+(_e-Ae)/(Pe?Ae-Ie:Ie-Ae))||0)},a:function(xe){return xe<0?Math.ceil(xe)||0:Math.floor(xe)},p:function(xe){return{M:j,y:J,w:Z,d:K,D:te,h:Y,m:q,s:W,ms:U,Q}[xe]||String(xe||"").toLowerCase().replace(/s$/,"")},u:function(xe){return xe===void 0}},he="en",ge={};ge[he]=oe;var ce=function(xe){return xe instanceof pe},me=function xe(ue,_e,Be){var Ae;if(!ue)return he;if(typeof ue=="string"){var Pe=ue.toLowerCase();ge[Pe]&&(Ae=Pe),_e&&(ge[Pe]=_e,Ae=Pe);var Ie=ue.split("-");if(!Ae&&Ie.length>1)return xe(Ie[0])}else{var Ce=ue.name;ge[Ce]=ue,Ae=Ce}return!Be&&Ae&&(he=Ae),Ae||!Be&&he},ye=function(xe,ue){if(ce(xe))return xe.clone();var _e=typeof ue=="object"?ue:{};return _e.date=xe,_e.args=arguments,new pe(_e)},ve=fe;ve.l=me,ve.i=ce,ve.w=function(xe,ue){return ye(xe,{locale:ue.$L,utc:ue.$u,x:ue.$x,$offset:ue.$offset})};var pe=function(){function xe(_e){this.$L=me(_e.locale,null,!0),this.parse(_e)}var ue=xe.prototype;return ue.parse=function(_e){this.$d=function(Be){var Ae=Be.date,Pe=Be.utc;if(Ae===null)return new Date(NaN);if(ve.u(Ae))return new Date;if(Ae instanceof Date)return new Date(Ae);if(typeof Ae=="string"&&!/Z$/i.test(Ae)){var Ie=Ae.match(ie);if(Ie){var Ce=Ie[2]-1||0,Te=(Ie[7]||"0").substring(0,3);return Pe?new Date(Date.UTC(Ie[1],Ce,Ie[3]||1,Ie[4]||0,Ie[5]||0,Ie[6]||0,Te)):new Date(Ie[1],Ce,Ie[3]||1,Ie[4]||0,Ie[5]||0,Ie[6]||0,Te)}}return new Date(Ae)}(_e),this.$x=_e.x||{},this.init()},ue.init=function(){var _e=this.$d;this.$y=_e.getFullYear(),this.$M=_e.getMonth(),this.$D=_e.getDate(),this.$W=_e.getDay(),this.$H=_e.getHours(),this.$m=_e.getMinutes(),this.$s=_e.getSeconds(),this.$ms=_e.getMilliseconds()},ue.$utils=function(){return ve},ue.isValid=function(){return this.$d.toString()!==ne},ue.isSame=function(_e,Be){var Ae=ye(_e);return this.startOf(Be)<=Ae&&Ae<=this.endOf(Be)},ue.isAfter=function(_e,Be){return ye(_e)B==12||B==4?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.3 1292 61.2 61.5 379.6 61.3 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 0 major G 2 C 5 15360 1 whole `,text:""}:B==5||B==6?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 1 major G 2 C 5 15360 1 whole `,text:"C"}:B==13?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -1 major G 2 F 4 15360 1 whole `,text:"F"}:B==14||B==15?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -2 major F 4 B -1 2 15360 1 whole `,text:"S"}:B==120?{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.3 1292 61.2 61.5 379.6 61.3 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 0 major G 2 A 5 15360 1 whole `,text:"A"}:{xml:` Click to add Title Click to add Composer Click to add Copyright 2021-08-27 SmartMusic 6.5000 40 1827.4 1292.1 61.3 61.5 355.6 61.4 1.0000 1.0000 5.0000 1.0000 1.0000 3.4199 1.0000 60 50 Music Music wind.flutes.flute Finale Default Bank 60 0 40 system 3840 -2 major G 2 B -1 4 15360 1 whole `,text:"Bb"};const checkStatus=ref("checking"),checkFrequency=ref(0),dotIcons=ref([iconWhite,iconWhite,iconWhite]),trend=ref(-1),time=ref(0),useStart=B=>{const R=getAllNodes(B);checkFrequency.value=R[0].frequency,postMessage({api:"proxyServiceMessage",content:{header:{status:200,commond:"xmlInfo",type:"SOUND_CHECK"},body:{frequency:checkFrequency.value}}}),postMessage({api:"startSoundCheck"},()=>{checkStatus.value="checking";try{localStorage.setItem(storeKeys.lastCheckTime,""+new Date().valueOf())}catch{}})},useEnd=()=>{postMessage({api:"endSoundCheck"})},useLister=()=>{const B=R=>{var D;const F=(D=R==null?void 0:R.content)==null?void 0:D.body.frequency;console.log("frequency",F,checkFrequency.value),trend.value=Math.abs(F-checkFrequency.value)<=5?0:F-checkFrequency.value>0?1:-1,dotIcons.value=[iconWhite,iconWhite,iconWhite],dotIcons.value[trend.value+1]=trend.value===0?iconGreen:iconRed,trend.value!==0&&(time.value=new Date().getTime()),new Date().getTime()-time.value>3e3&&(useEnd(),checkStatus.value="success",dotIcons.value=[iconGreen,iconGreen,iconGreen],setTimeout(()=>{soundEffectShow.value=!1},1e3))};onMounted(()=>{listenerMessage("sendResult",B)}),onBeforeUnmount(()=>{removeListenerMessage("sendResult",B)})},soundEffectShow=ref(!1);var SoundEffect=defineComponent({name:"ColexiuSoundEffect",emits:["success","close","pass","fail"],setup(B,{emit:R}){const F=ref(!1),D=ref(!1),G=U=>{U.text==="\u5173\u95ED\u6821\u97F3"&&(state$4.sett.tuning=!1),R("pass"),soundEffectShow.value=!1};return useLister(),watch([soundEffectShow,checkStatus],()=>{checkStatus.value==="success"&&R("success"),checkStatus.value==="fail"&&R("fail"),soundEffectShow.value===!1&&(F.value=!1,R("close"),useEnd())}),()=>{const U=score(2),W=(U==null?void 0:U.xml)||"";return createVNode(Popup,{position:"bottom",show:soundEffectShow.value,"onUpdate:show":q=>soundEffectShow.value=q,onOpen:()=>F.value=!0,onClosed:()=>F.value=!1,teleport:"body"},{default:()=>[createVNode("div",{class:styles$f.box},[createVNode("img",{class:styles$f.iconSound,src:iconSound$1},null),createVNode("div",{class:styles$f.wrap},[createVNode("div",{class:styles$f.staff},[F.value&&createVNode(MusicSheet,{isSoundEffect:!0,opotions:{stretchLastSystemLine:!0,drawMetronomeMarks:!1,drawPartAbbreviations:!1,drawPartNames:!1,drawSlurs:!1,drawTimeSignatures:!1,followCursor:!1},score:W,showSection:!1,onRerender:useStart},null)]),createVNode("div",{class:styles$f.des},[createTextVNode("\u8BF7\u6F14\u594F "),createVNode("span",{style:{color:"var(--primary-color)"}},[U.text]),createTextVNode("\u76F4\u5230\u7EFF\u706F\u5168\u90E8\u4EAE\u8D77")]),createVNode("div",{class:styles$f.lampWrap},[dotIcons.value.map((q,Y)=>createVNode("div",{class:styles$f.lamp,key:Y},[createVNode("img",{class:[checkStatus.value==="checking"&&styles$f.flickerAnimate],src:q},null)]))])]),createVNode("img",{class:styles$f.bottom,src:iconBottom},null),createVNode(Button,{class:styles$f.button,icon:backIcon,onClick:()=>soundEffectShow.value=!1},null),createVNode(Popover,{class:styles$f.skepItems,show:D.value,"onUpdate:show":q=>D.value=q,actions:[{text:"\u8DF3\u8FC7\u672C\u6B21"},{text:"\u5173\u95ED\u6821\u97F3"}],onSelect:q=>G(q),showArrow:!1},{reference:()=>createVNode(Button,{class:styles$f.skepBtn,icon:iconArrow,iconPosition:"right"},{default:()=>[createTextVNode("\u8DF3\u8FC7\u672C\u6B21")]})})])]})}}});const box="_box_a7vlt_1",bg$2="_bg_a7vlt_9",button$2="_button_a7vlt_16",iconSound="_iconSound_a7vlt_33",skepBtn="_skepBtn_a7vlt_39",wrap$4="_wrap_a7vlt_53",wrapContainer="_wrapContainer_a7vlt_59",top="_top_a7vlt_65",title$6="_title_a7vlt_72",num="_num_a7vlt_82",txt="_txt_a7vlt_86",iconLeft="_iconLeft_a7vlt_89",iconTop="_iconTop_a7vlt_93",evaluatWrap="_evaluatWrap_a7vlt_98",evaluatTitle="_evaluatTitle_a7vlt_129",evaluatIcon="_evaluatIcon_a7vlt_134",fraction="_fraction_a7vlt_140",line="_line_a7vlt_147",tips="_tips_a7vlt_152",btns="_btns_a7vlt_165",btnIcon="_btnIcon_a7vlt_178",rigthBtns="_rigthBtns_a7vlt_183",confirm="_confirm_a7vlt_193",iconTitle$1="_iconTitle_a7vlt_199",footer="_footer_a7vlt_204",sbtn="_sbtn_a7vlt_233";var styles$e={box,bg:bg$2,button:button$2,iconSound,skepBtn,wrap:wrap$4,wrapContainer,top,title:title$6,num,txt,iconLeft,iconTop,evaluatWrap,evaluatTitle,evaluatIcon,fraction,line,tips,btns,btnIcon,rigthBtns,confirm,iconTitle:iconTitle$1,footer,sbtn},iconTitle="/orchestra-music-score/assets/title.26d31e69.svg",iconCancel="/orchestra-music-score/assets/cancel.79fe3f5e.svg",iconConfirm="/orchestra-music-score/assets/confirm.8050789e.svg",iconLianxi="/orchestra-music-score/assets/icon-lianxi.104eeb83.svg",iconReport="/orchestra-music-score/assets/icon-report.7c7e9fcf.svg",TryIcon="/orchestra-music-score/assets/try.8a1d0eec.svg",IntegrityIcon="/orchestra-music-score/assets/integrity.f311836f.svg",IntonationIcon="/orchestra-music-score/assets/intonation.64e00f66.svg",CadenceIcon="/orchestra-music-score/assets/cadence.18a7a60b.svg",Image1$1="/orchestra-music-score/assets/5.d8bfbf51.png",Image2$1="/orchestra-music-score/assets/4.cfa387c7.png",Image3$1="/orchestra-music-score/assets/3.d02c685a.png",Image4$1="/orchestra-music-score/assets/2.5c4c2ef5.png",Image5$1="/orchestra-music-score/assets/1.a0d5037d.png",IconBad="/orchestra-music-score/assets/bad.d9395829.png",IconGood="/orchestra-music-score/assets/good.b0fbfb32.png",IconGreat="/orchestra-music-score/assets/great.55272f0a.png",IconPerfect="/orchestra-music-score/assets/perfect.ab44b0e5.png";const icons={1:{icon:IconBad,text:"bad"},2:{icon:IconGood,text:"good"},3:{icon:IconGreat,text:"great"},4:{icon:IconPerfect,text:"perfect"}};var constant={1:{img:Image1$1,tips:"\u4F60\u7684\u6F14\u594F\u4E0D\u592A\u597D\uFF0C\u518D\u7EC3\u4E00\u7EC3\u5427\uFF5E",mome:"\u6562\u4E8E\u5C1D\u8BD5"},2:{img:Image2$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u719F\u7EC3\uFF0C\u52A0\u7D27\u8BAD\u7EC3\u624D\u80FD\u6709\u597D\u6210\u7EE9\u54E6\uFF5E",mome:"\u8FD8\u8981\u52A0\u6CB9\u54E6\uFF5E"},3:{img:Image3$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u6D41\u7545\uFF0C\u79D1\u5B66\u7684\u7EC3\u4E60\u624D\u80FD\u66F4\u5B8C\u7F8E\u54E6\uFF5E",mome:"\u7A81\u7834\u81EA\u6211"},4:{img:Image4$1,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u9519\uFF0C\u7EE7\u7EED\u52A0\u6CB9\u5427\uFF0C\u79BB\u5B8C\u7F8E\u5C31\u5DEE\u4E00\u6B65\u5566\uFF5E",mome:"\u5D2D\u9732\u5934\u89D2"},5:{img:Image5$1,tips:"\u4F60\u7684\u6F14\u594F\u5B8C\u7F8E\u65E0\u7F3A\uFF0C\u7EE7\u7EED\u52AA\u529B\u5427\uFF5E",mome:"\u4F60\u5F88\u68D2"}};const getLeveByScoreId=B=>{if(!B&&typeof B!="number")return{};let R=1;return B>20&&B<=40?R=2:B>40&&B<=60?R=3:B>60&&B<=80?R=4:B>80&&(R=5),R},getLeveByScore=B=>{if(!B&&typeof B!="number")return{};let R=getLeveByScoreId(B);return constant[R]},getLeveByScoreMeasure=B=>{if(!B&&typeof B!="number")return{};let R=1;return B>=40&&B<70?R=2:B>=70&&B<90?R=3:B>=90&&(R=4),icons[R]};var Image1="/orchestra-music-score/assets/5.a95933dd.svg",Image2="/orchestra-music-score/assets/4.49f14e1f.svg",Image3="/orchestra-music-score/assets/3.240ee5fd.svg",Image4="/orchestra-music-score/assets/2.ce512136.svg",Image5="/orchestra-music-score/assets/1.aad3802e.svg",iconShare="/orchestra-music-score/assets/icon-share.9f124616.svg",iconUpload="/orchestra-music-score/assets/icon-upload.53f774c1.svg",accompaniment="/orchestra-music-score/assets/accompaniment.b83f0e6e.svg",__glob_2_0=Object.freeze(Object.defineProperty({__proto__:null,default:accompaniment},Symbol.toStringTag,{value:"Module"})),back$1="/orchestra-music-score/assets/back.0e8784e6.svg",__glob_2_1=Object.freeze(Object.defineProperty({__proto__:null,default:back$1},Symbol.toStringTag,{value:"Module"})),backgroundClose="/orchestra-music-score/assets/background-close.292949ba.svg",__glob_2_2=Object.freeze(Object.defineProperty({__proto__:null,default:backgroundClose},Symbol.toStringTag,{value:"Module"})),background$1="/orchestra-music-score/assets/background.66e3a94f.svg",__glob_2_3=Object.freeze(Object.defineProperty({__proto__:null,default:background$1},Symbol.toStringTag,{value:"Module"})),camera="/orchestra-music-score/assets/camera.6735691d.svg",__glob_2_4=Object.freeze(Object.defineProperty({__proto__:null,default:camera},Symbol.toStringTag,{value:"Module"})),equilibrium="/orchestra-music-score/assets/equilibrium.f9043cf5.svg",__glob_2_5=Object.freeze(Object.defineProperty({__proto__:null,default:equilibrium},Symbol.toStringTag,{value:"Module"})),evaluating$1="/orchestra-music-score/assets/evaluating.9eb5cfac.svg",__glob_2_6=Object.freeze(Object.defineProperty({__proto__:null,default:evaluating$1},Symbol.toStringTag,{value:"Module"})),fingeringOff="/orchestra-music-score/assets/fingeringOff.b63542d4.svg",__glob_2_7=Object.freeze(Object.defineProperty({__proto__:null,default:fingeringOff},Symbol.toStringTag,{value:"Module"})),fingeringOn="/orchestra-music-score/assets/fingeringOn.32644085.svg",__glob_2_8=Object.freeze(Object.defineProperty({__proto__:null,default:fingeringOn},Symbol.toStringTag,{value:"Module"})),gudingActive="/orchestra-music-score/assets/guding-active.ffb42216.svg",__glob_2_9=Object.freeze(Object.defineProperty({__proto__:null,default:gudingActive},Symbol.toStringTag,{value:"Module"})),guding="/orchestra-music-score/assets/guding.a3ea7233.svg",__glob_2_10=Object.freeze(Object.defineProperty({__proto__:null,default:guding},Symbol.toStringTag,{value:"Module"})),iconBack="/orchestra-music-score/assets/icon-back.f7c9eb40.svg",__glob_2_11=Object.freeze(Object.defineProperty({__proto__:null,default:iconBack},Symbol.toStringTag,{value:"Module"})),iconEvaluatingEnd="/orchestra-music-score/assets/icon-evaluatingEnd.438e3cc0.svg",__glob_2_12=Object.freeze(Object.defineProperty({__proto__:null,default:iconEvaluatingEnd},Symbol.toStringTag,{value:"Module"})),iconEvaluatingStart="/orchestra-music-score/assets/icon-evaluatingStart.ef7aea8e.svg",__glob_2_13=Object.freeze(Object.defineProperty({__proto__:null,default:iconEvaluatingStart},Symbol.toStringTag,{value:"Module"})),iconStaffActive="/orchestra-music-score/assets/icon-staff-active.c1d6b682.svg",__glob_2_14=Object.freeze(Object.defineProperty({__proto__:null,default:iconStaffActive},Symbol.toStringTag,{value:"Module"})),iconStaff="/orchestra-music-score/assets/icon-staff.5a2b7c94.svg",__glob_2_15=Object.freeze(Object.defineProperty({__proto__:null,default:iconStaff},Symbol.toStringTag,{value:"Module"})),iconZhuanpu="/orchestra-music-score/assets/icon-zhuanpu.1a6e0bcb.svg",__glob_2_16=Object.freeze(Object.defineProperty({__proto__:null,default:iconZhuanpu},Symbol.toStringTag,{value:"Module"})),jia="/orchestra-music-score/assets/jia.362e133d.svg",__glob_2_17=Object.freeze(Object.defineProperty({__proto__:null,default:jia},Symbol.toStringTag,{value:"Module"})),jian="/orchestra-music-score/assets/jian.ce0820a8.svg",__glob_2_18=Object.freeze(Object.defineProperty({__proto__:null,default:jian},Symbol.toStringTag,{value:"Module"})),jianpu="/orchestra-music-score/assets/jianpu.70310e35.svg",__glob_2_19=Object.freeze(Object.defineProperty({__proto__:null,default:jianpu},Symbol.toStringTag,{value:"Module"})),model1="/orchestra-music-score/assets/model-1.5cdc3b59.svg",__glob_2_20=Object.freeze(Object.defineProperty({__proto__:null,default:model1},Symbol.toStringTag,{value:"Module"})),model2="/orchestra-music-score/assets/model-2.aedda1e7.svg",__glob_2_21=Object.freeze(Object.defineProperty({__proto__:null,default:model2},Symbol.toStringTag,{value:"Module"})),model3="/orchestra-music-score/assets/model-3.f6cc2e96.svg",__glob_2_22=Object.freeze(Object.defineProperty({__proto__:null,default:model3},Symbol.toStringTag,{value:"Module"})),modelType$1="/orchestra-music-score/assets/modelType.7dff5016.svg",__glob_2_23=Object.freeze(Object.defineProperty({__proto__:null,default:modelType$1},Symbol.toStringTag,{value:"Module"})),musicList="/orchestra-music-score/assets/music-list.8ad9f128.svg",__glob_2_24=Object.freeze(Object.defineProperty({__proto__:null,default:musicList},Symbol.toStringTag,{value:"Module"})),musicList1="/orchestra-music-score/assets/music-list1.16180b5c.svg",__glob_2_25=Object.freeze(Object.defineProperty({__proto__:null,default:musicList1},Symbol.toStringTag,{value:"Module"})),music="/orchestra-music-score/assets/music.855d26de.svg",__glob_2_26=Object.freeze(Object.defineProperty({__proto__:null,default:music},Symbol.toStringTag,{value:"Module"})),part="/orchestra-music-score/assets/part.7184ecd4.svg",__glob_2_27=Object.freeze(Object.defineProperty({__proto__:null,default:part},Symbol.toStringTag,{value:"Module"})),pause$1="/orchestra-music-score/assets/pause.1f3a158e.svg",__glob_2_28=Object.freeze(Object.defineProperty({__proto__:null,default:pause$1},Symbol.toStringTag,{value:"Module"})),play$1="/orchestra-music-score/assets/play.4cb46bbb.svg",__glob_2_29=Object.freeze(Object.defineProperty({__proto__:null,default:play$1},Symbol.toStringTag,{value:"Module"})),practice="/orchestra-music-score/assets/practice.a1fec217.svg",__glob_2_30=Object.freeze(Object.defineProperty({__proto__:null,default:practice},Symbol.toStringTag,{value:"Module"})),practise="/orchestra-music-score/assets/practise.cdd135b3.svg",__glob_2_31=Object.freeze(Object.defineProperty({__proto__:null,default:practise},Symbol.toStringTag,{value:"Module"})),record="/orchestra-music-score/assets/record.214e6a6d.svg",__glob_2_32=Object.freeze(Object.defineProperty({__proto__:null,default:record},Symbol.toStringTag,{value:"Module"})),resetShengyin="/orchestra-music-score/assets/reset-shengyin.af688c9a.svg",__glob_2_33=Object.freeze(Object.defineProperty({__proto__:null,default:resetShengyin},Symbol.toStringTag,{value:"Module"})),reset="/orchestra-music-score/assets/reset.8f0314cd.svg",__glob_2_34=Object.freeze(Object.defineProperty({__proto__:null,default:reset},Symbol.toStringTag,{value:"Module"})),restore="/orchestra-music-score/assets/restore.3a4a6db3.svg",__glob_2_35=Object.freeze(Object.defineProperty({__proto__:null,default:restore},Symbol.toStringTag,{value:"Module"})),section$1="/orchestra-music-score/assets/section.f9765b45.svg",__glob_2_36=Object.freeze(Object.defineProperty({__proto__:null,default:section$1},Symbol.toStringTag,{value:"Module"})),section1="/orchestra-music-score/assets/section1.8f6086dd.svg",__glob_2_37=Object.freeze(Object.defineProperty({__proto__:null,default:section1},Symbol.toStringTag,{value:"Module"})),section2="/orchestra-music-score/assets/section2.7715197f.svg",__glob_2_38=Object.freeze(Object.defineProperty({__proto__:null,default:section2},Symbol.toStringTag,{value:"Module"})),setting$1="/orchestra-music-score/assets/setting.d2c48eac.svg",__glob_2_39=Object.freeze(Object.defineProperty({__proto__:null,default:setting$1},Symbol.toStringTag,{value:"Module"})),shuodiaoActive="/orchestra-music-score/assets/shuodiao-active.6b157b93.svg",__glob_2_40=Object.freeze(Object.defineProperty({__proto__:null,default:shuodiaoActive},Symbol.toStringTag,{value:"Module"})),shuodiao="/orchestra-music-score/assets/shuodiao.da855d30.svg",__glob_2_41=Object.freeze(Object.defineProperty({__proto__:null,default:shuodiao},Symbol.toStringTag,{value:"Module"})),speed$2="/orchestra-music-score/assets/speed.256b84ef.svg",__glob_2_42=Object.freeze(Object.defineProperty({__proto__:null,default:speed$2},Symbol.toStringTag,{value:"Module"})),staff="/orchestra-music-score/assets/staff.f226ff22.svg",__glob_2_43=Object.freeze(Object.defineProperty({__proto__:null,default:staff},Symbol.toStringTag,{value:"Module"})),start$3="/orchestra-music-score/assets/start.7b27072b.svg",__glob_2_44=Object.freeze(Object.defineProperty({__proto__:null,default:start$3},Symbol.toStringTag,{value:"Module"})),stop="/orchestra-music-score/assets/stop.e36ceb44.svg",__glob_2_45=Object.freeze(Object.defineProperty({__proto__:null,default:stop},Symbol.toStringTag,{value:"Module"})),taskBg="/orchestra-music-score/assets/task-bg.859300d7.svg",__glob_2_46=Object.freeze(Object.defineProperty({__proto__:null,default:taskBg},Symbol.toStringTag,{value:"Module"})),tuning="/orchestra-music-score/assets/tuning.4b86afaf.svg",__glob_2_47=Object.freeze(Object.defineProperty({__proto__:null,default:tuning},Symbol.toStringTag,{value:"Module"})),volPlus="/orchestra-music-score/assets/vol-plus.8301fc70.svg",__glob_2_48=Object.freeze(Object.defineProperty({__proto__:null,default:volPlus},Symbol.toStringTag,{value:"Module"})),vol="/orchestra-music-score/assets/vol.4b3b0407.svg",__glob_2_49=Object.freeze(Object.defineProperty({__proto__:null,default:vol},Symbol.toStringTag,{value:"Module"})),____="/orchestra-music-score/assets/\u8BC4\u6D4B\u8BB0\u5F55.5949e468.svg",__glob_2_50=Object.freeze(Object.defineProperty({__proto__:null,default:____},Symbol.toStringTag,{value:"Module"}));const getAssetsHomeFile=B=>{var D;const R=`./icons/${B}.svg`;return(D={"./icons/accompaniment.svg":__glob_2_0,"./icons/back.svg":__glob_2_1,"./icons/background-close.svg":__glob_2_2,"./icons/background.svg":__glob_2_3,"./icons/camera.svg":__glob_2_4,"./icons/equilibrium.svg":__glob_2_5,"./icons/evaluating.svg":__glob_2_6,"./icons/fingeringOff.svg":__glob_2_7,"./icons/fingeringOn.svg":__glob_2_8,"./icons/guding-active.svg":__glob_2_9,"./icons/guding.svg":__glob_2_10,"./icons/icon-back.svg":__glob_2_11,"./icons/icon-evaluatingEnd.svg":__glob_2_12,"./icons/icon-evaluatingStart.svg":__glob_2_13,"./icons/icon-staff-active.svg":__glob_2_14,"./icons/icon-staff.svg":__glob_2_15,"./icons/icon-zhuanpu.svg":__glob_2_16,"./icons/jia.svg":__glob_2_17,"./icons/jian.svg":__glob_2_18,"./icons/jianpu.svg":__glob_2_19,"./icons/model-1.svg":__glob_2_20,"./icons/model-2.svg":__glob_2_21,"./icons/model-3.svg":__glob_2_22,"./icons/modelType.svg":__glob_2_23,"./icons/music-list.svg":__glob_2_24,"./icons/music-list1.svg":__glob_2_25,"./icons/music.svg":__glob_2_26,"./icons/part.svg":__glob_2_27,"./icons/pause.svg":__glob_2_28,"./icons/play.svg":__glob_2_29,"./icons/practice.svg":__glob_2_30,"./icons/practise.svg":__glob_2_31,"./icons/record.svg":__glob_2_32,"./icons/reset-shengyin.svg":__glob_2_33,"./icons/reset.svg":__glob_2_34,"./icons/restore.svg":__glob_2_35,"./icons/section.svg":__glob_2_36,"./icons/section1.svg":__glob_2_37,"./icons/section2.svg":__glob_2_38,"./icons/setting.svg":__glob_2_39,"./icons/shuodiao-active.svg":__glob_2_40,"./icons/shuodiao.svg":__glob_2_41,"./icons/speed.svg":__glob_2_42,"./icons/staff.svg":__glob_2_43,"./icons/start.svg":__glob_2_44,"./icons/stop.svg":__glob_2_45,"./icons/task-bg.svg":__glob_2_46,"./icons/tuning.svg":__glob_2_47,"./icons/vol-plus.svg":__glob_2_48,"./icons/vol.svg":__glob_2_49,"./icons/\u8BC4\u6D4B\u8BB0\u5F55.svg":__glob_2_50}[R])==null?void 0:D.default};var ButtonIcon=defineComponent({name:"ButtonIcon",props:{name:{type:String}},setup(B){return()=>B.name?createVNode("img",{src:getAssetsHomeFile(B.name)},null):null}}),classnames$1={exports:{}};/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */(function(B){(function(){var R={}.hasOwnProperty;function F(){for(var D=[],G=0;G{}},updateSpeed:{type:Function,default:B=>{}},mode:{type:String},changeMode:{type:Function,default:B=>{}},lib:{type:Object}},setup(B){var Y;const{lib:R}=toRefs(B);state$1.speed=(Y=R.value)==null?void 0:Y.speed;const F=()=>{state$1.showHint=!0},D=()=>{state$1.showHint=!1},G=K=>{state$1.speed=K,B.changed(state$1.speed)},U=K=>{state$1.speed=K,B.updateSpeed(state$1.speed)},W=()=>{state$1.speed=Math.max(state$1.speed-1,45),B.changed(state$1.speed)},q=()=>{state$1.speed=Math.min(state$1.speed+1,270),B.changed(state$1.speed)};return()=>createVNode("div",{class:styles$d["speed-change"]},[createVNode("div",{class:styles$d.speed},[createVNode("div",null,[createVNode(Button,{color:"#01C1B5",icon:iconPlus,type:"primary",size:"mini",round:!0,disabled:state$1.speed==270,onClick:q},null),createVNode(Slider,{class:styles$d.slider,max:270,min:45,barHeight:"3px",buttonSize:"18px",modelValue:315-state$1.speed,"onUpdate:modelValue":K=>U(315-K),step:"1",vertical:!0,activeColor:"#ebedf0",onChange:K=>G(315-K),onDragStart:F,onDragEnd:D},{button:()=>createVNode("div",{class:styles$d["custom-button"]},[createVNode("span",null,[state$1.speed]),createVNode("div",{class:classnames(styles$d.title)},[createVNode("span",{class:styles$d.strong},[state$1.speed])])])}),createVNode(Button,{class:styles$d.min,color:"#01C1B5",icon:iconMinus,type:"primary",size:"mini",round:!0,disabled:state$1.speed==45,onClick:W},null),createVNode(Button,{class:styles$d.reset,color:"#01C1B5",icon:iconresetMinus,type:"primary",size:"mini",round:!0,onClick:()=>{var K;state$2.activeDetail&&G((K=state$2.activeDetail)==null?void 0:K.originalSpeed)}},null)])])])},methods:{resetSpeed(){var B,R;state$1.speed=(B=this.lib)==null?void 0:B.speed,this.changed((R=this.lib)==null?void 0:R.speed)},refUpdateSpeed(B){state$1.speed=B,this.updateSpeed(state$1.speed)}}});const close="_close_1xean_1",bg$1="_bg_1xean_12";var styles$c={close,bg:bg$1},iconColse="/orchestra-music-score/assets/close.c15efc4b.svg",Popups=defineComponent({name:"ColexiuPopup",props:{data:{type:Object,default:()=>null},zIndex:{type:Number,default:void 0},closeable:{type:Boolean,default:!0},overlay:{type:Boolean,default:!0},style:{type:Object}},setup(B,{slots:R,expose:F}){const D=ref(!1),G=ref(!1),U=()=>{D.value=!0,G.value=!0},W=()=>{D.value=!1},q=()=>{G.value=!1};return F({show:D,close:()=>{D.value=!1},onShow:U,onClose:W,onClosed:q}),()=>createVNode(Popup,{show:D.value,zIndex:B.zIndex,onClose:W,onClosed:q,teleport:"body",onClickOverlay:W,overlay:B.overlay,round:!0,closeable:!1,style:{...B.style},class:styles$c.bg},{default:()=>[G.value&&R.default&&R.default(B),B.closeable&&createVNode(Icon,{class:styles$c.close,name:iconColse,onClick:W},null)]})}});const title$4="_title_184ej_1",wrap$3="_wrap_184ej_8",item="_item_184ej_14",label$1="_label_184ej_18";var styles$b={title:title$4,wrap:wrap$3,item,label:label$1};const sliderClass={"active-color":"#FFB871","inactive-color":"#EAEAEA","button-size":"14"};var Equalizer=defineComponent({name:"ColexiuEqualizer",setup(){const B=ref(10);return()=>createVNode("div",{class:"containerPopups"},[createVNode("div",{class:styles$b.title},[createTextVNode("\u5747\u8861\u5668")]),createVNode("div",{class:styles$b.wrap},[createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u8282\u62CD\u5668")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u4F34\u594F")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u957F\u7B1B")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u8428\u514B\u65AF")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u5355\u7C27\u7BA1")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)]),createVNode(Divider,null,null),createVNode("div",{class:styles$b.item},[createVNode("span",{class:styles$b.label},[createTextVNode("\u957F\u53F7")]),createVNode(Slider,mergeProps({modelValue:B.value,"onUpdate:modelValue":R=>B.value=R},sliderClass),null)])])])}});const container$2="_container_la5im_1",title$3="_title_la5im_5",practiseBtn="_practiseBtn_la5im_12",wrap$2="_wrap_la5im_21";var styles$a={container:container$2,title:title$3,practiseBtn,wrap:wrap$2};function _isSlot$2(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}const search$5=useOriginSearch();var Part=defineComponent({name:"ColexiuPart",setup(){const B=Number(search$5["part-index"])||0,R=ref(state$2.partListNames[B]),F=()=>{const D=state$2.partListNames.indexOf(R.value);R.value=state$2.partListNames[D];const G=queryString.stringify({...search$5,"part-index":D});location.search=G};return()=>{let D;return createVNode("div",{class:["containerPopups",styles$a.container]},[createVNode("div",{class:styles$a.title},[createTextVNode("\u58F0\u90E8\u9009\u62E9")]),createVNode("div",{class:styles$a.wrap},[createVNode(RadioGroup,{modelValue:R.value,"onUpdate:modelValue":G=>R.value=G},_isSlot$2(D=state$2.partListNames.map(G=>createVNode(Radio,{name:G},_isSlot$2(G)?G:{default:()=>[G]})))?D:{default:()=>[D]})]),createVNode("div",{style:{display:"flex",justifyContent:"center"}},[createVNode(Button,{class:styles$a.practiseBtn,onClick:F},null)])])}}});const partPopup=ref(null),equalizerPopup=ref(null);var FloatWraper=defineComponent({name:"ColuxiuFloatWraper",setup(){return()=>createVNode(Fragment,null,[createVNode(Popups,{ref:partPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Part,null,null)]}),createVNode(Popups,{ref:equalizerPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Equalizer,null,null)]})])}});function _taggedTemplateLiteral(B,R){return R||(R=B.slice(0)),Object.freeze(Object.defineProperties(B,{raw:{value:Object.freeze(R)}}))}function __decorate(B,R,F,D){var G,U=arguments.length,W=U<3?R:D===null?D=Object.getOwnPropertyDescriptor(R,F):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(B,R,F,D);else for(var q=B.length-1;q>=0;q--)(G=B[q])&&(W=(U<3?G(W):U>3?G(R,F,W):G(R,F))||W);return U>3&&W&&Object.defineProperty(R,F,W),W}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const t$3=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e$8=Symbol(),n$5=new Map;class s$3{constructor(R,F){if(this._$cssResult$=!0,F!==e$8)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=R}get styleSheet(){let R=n$5.get(this.cssText);return t$3&&R===void 0&&(n$5.set(this.cssText,R=new CSSStyleSheet),R.replaceSync(this.cssText)),R}toString(){return this.cssText}}const o$5=B=>new s$3(typeof B=="string"?B:B+"",e$8),r$3=(B,...R)=>{const F=B.length===1?B[0]:R.reduce((D,G,U)=>D+(W=>{if(W._$cssResult$===!0)return W.cssText;if(typeof W=="number")return W;throw Error("Value passed to 'css' function must be a 'css' function result: "+W+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(G)+B[U+1],B[0]);return new s$3(F,e$8)},i$3=(B,R)=>{t$3?B.adoptedStyleSheets=R.map(F=>F instanceof CSSStyleSheet?F:F.styleSheet):R.forEach(F=>{const D=document.createElement("style"),G=window.litNonce;G!==void 0&&D.setAttribute("nonce",G),D.textContent=F.cssText,B.appendChild(D)})},S$1=t$3?B=>B:B=>B instanceof CSSStyleSheet?(R=>{let F="";for(const D of R.cssRules)F+=D.cssText;return o$5(F)})(B):B;var s$2;const e$7=window.trustedTypes,r$2=e$7?e$7.emptyScript:"",h$2=window.reactiveElementPolyfillSupport,o$4={toAttribute(B,R){switch(R){case Boolean:B=B?r$2:null;break;case Object:case Array:B=B==null?B:JSON.stringify(B)}return B},fromAttribute(B,R){let F=B;switch(R){case Boolean:F=B!==null;break;case Number:F=B===null?null:Number(B);break;case Object:case Array:try{F=JSON.parse(B)}catch{F=null}}return F}},n$4=(B,R)=>R!==B&&(R==R||B==B),l$3={attribute:!0,type:String,converter:o$4,reflect:!1,hasChanged:n$4};class a$1 extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(R){var F;(F=this.l)!==null&&F!==void 0||(this.l=[]),this.l.push(R)}static get observedAttributes(){this.finalize();const R=[];return this.elementProperties.forEach((F,D)=>{const G=this._$Eh(D,F);G!==void 0&&(this._$Eu.set(G,D),R.push(G))}),R}static createProperty(R,F=l$3){if(F.state&&(F.attribute=!1),this.finalize(),this.elementProperties.set(R,F),!F.noAccessor&&!this.prototype.hasOwnProperty(R)){const D=typeof R=="symbol"?Symbol():"__"+R,G=this.getPropertyDescriptor(R,D,F);G!==void 0&&Object.defineProperty(this.prototype,R,G)}}static getPropertyDescriptor(R,F,D){return{get(){return this[F]},set(G){const U=this[R];this[F]=G,this.requestUpdate(R,U,D)},configurable:!0,enumerable:!0}}static getPropertyOptions(R){return this.elementProperties.get(R)||l$3}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const R=Object.getPrototypeOf(this);if(R.finalize(),this.elementProperties=new Map(R.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const F=this.properties,D=[...Object.getOwnPropertyNames(F),...Object.getOwnPropertySymbols(F)];for(const G of D)this.createProperty(G,F[G])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(R){const F=[];if(Array.isArray(R)){const D=new Set(R.flat(1/0).reverse());for(const G of D)F.unshift(S$1(G))}else R!==void 0&&F.push(S$1(R));return F}static _$Eh(R,F){const D=F.attribute;return D===!1?void 0:typeof D=="string"?D:typeof R=="string"?R.toLowerCase():void 0}o(){var R;this._$Ep=new Promise(F=>this.enableUpdating=F),this._$AL=new Map,this._$Em(),this.requestUpdate(),(R=this.constructor.l)===null||R===void 0||R.forEach(F=>F(this))}addController(R){var F,D;((F=this._$Eg)!==null&&F!==void 0?F:this._$Eg=[]).push(R),this.renderRoot!==void 0&&this.isConnected&&((D=R.hostConnected)===null||D===void 0||D.call(R))}removeController(R){var F;(F=this._$Eg)===null||F===void 0||F.splice(this._$Eg.indexOf(R)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach((R,F)=>{this.hasOwnProperty(F)&&(this._$Et.set(F,this[F]),delete this[F])})}createRenderRoot(){var R;const F=(R=this.shadowRoot)!==null&&R!==void 0?R:this.attachShadow(this.constructor.shadowRootOptions);return i$3(F,this.constructor.elementStyles),F}connectedCallback(){var R;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(R=this._$Eg)===null||R===void 0||R.forEach(F=>{var D;return(D=F.hostConnected)===null||D===void 0?void 0:D.call(F)})}enableUpdating(R){}disconnectedCallback(){var R;(R=this._$Eg)===null||R===void 0||R.forEach(F=>{var D;return(D=F.hostDisconnected)===null||D===void 0?void 0:D.call(F)})}attributeChangedCallback(R,F,D){this._$AK(R,D)}_$ES(R,F,D=l$3){var G,U;const W=this.constructor._$Eh(R,D);if(W!==void 0&&D.reflect===!0){const q=((U=(G=D.converter)===null||G===void 0?void 0:G.toAttribute)!==null&&U!==void 0?U:o$4.toAttribute)(F,D.type);this._$Ei=R,q==null?this.removeAttribute(W):this.setAttribute(W,q),this._$Ei=null}}_$AK(R,F){var D,G,U;const W=this.constructor,q=W._$Eu.get(R);if(q!==void 0&&this._$Ei!==q){const Y=W.getPropertyOptions(q),K=Y.converter,Z=(U=(G=(D=K)===null||D===void 0?void 0:D.fromAttribute)!==null&&G!==void 0?G:typeof K=="function"?K:null)!==null&&U!==void 0?U:o$4.fromAttribute;this._$Ei=q,this[q]=Z(F,Y.type),this._$Ei=null}}requestUpdate(R,F,D){let G=!0;R!==void 0&&(((D=D||this.constructor.getPropertyOptions(R)).hasChanged||n$4)(this[R],F)?(this._$AL.has(R)||this._$AL.set(R,F),D.reflect===!0&&this._$Ei!==R&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(R,D))):G=!1),!this.isUpdatePending&&G&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(F){Promise.reject(F)}const R=this.scheduleUpdate();return R!=null&&await R,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var R;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((G,U)=>this[U]=G),this._$Et=void 0);let F=!1;const D=this._$AL;try{F=this.shouldUpdate(D),F?(this.willUpdate(D),(R=this._$Eg)===null||R===void 0||R.forEach(G=>{var U;return(U=G.hostUpdate)===null||U===void 0?void 0:U.call(G)}),this.update(D)):this._$EU()}catch(G){throw F=!1,this._$EU(),G}F&&this._$AE(D)}willUpdate(R){}_$AE(R){var F;(F=this._$Eg)===null||F===void 0||F.forEach(D=>{var G;return(G=D.hostUpdated)===null||G===void 0?void 0:G.call(D)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(R)),this.updated(R)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(R){return!0}update(R){this._$EC!==void 0&&(this._$EC.forEach((F,D)=>this._$ES(D,this[D],F)),this._$EC=void 0),this._$EU()}updated(R){}firstUpdated(R){}}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */var t$2;a$1.finalized=!0,a$1.elementProperties=new Map,a$1.elementStyles=[],a$1.shadowRootOptions={mode:"open"},h$2==null||h$2({ReactiveElement:a$1}),((s$2=globalThis.reactiveElementVersions)!==null&&s$2!==void 0?s$2:globalThis.reactiveElementVersions=[]).push("1.3.1");const i$2=globalThis.trustedTypes,s$1=i$2?i$2.createPolicy("lit-html",{createHTML:B=>B}):void 0,e$6=`lit$${(Math.random()+"").slice(9)}$`,o$3="?"+e$6,n$3=`<${o$3}>`,l$2=document,h$1=(B="")=>l$2.createComment(B),r$1=B=>B===null||typeof B!="object"&&typeof B!="function",d=Array.isArray,u$1=B=>{var R;return d(B)||typeof((R=B)===null||R===void 0?void 0:R[Symbol.iterator])=="function"},c$2=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,a$2=/>/g,f$1=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_$1=/'/g,m$2=/"/g,g=/^(?:script|style|textarea|title)$/i,p$1=B=>(R,...F)=>({_$litType$:B,strings:R,values:F}),$=p$1(1),b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T$1=new WeakMap,x=(B,R,F)=>{var D,G;const U=(D=F==null?void 0:F.renderBefore)!==null&&D!==void 0?D:R;let W=U._$litPart$;if(W===void 0){const q=(G=F==null?void 0:F.renderBefore)!==null&&G!==void 0?G:null;U._$litPart$=W=new N$1(R.insertBefore(h$1(),q),q,void 0,F!=null?F:{})}return W._$AI(B),W},A=l$2.createTreeWalker(l$2,129,null,!1),C=(B,R)=>{const F=B.length-1,D=[];let G,U=R===2?"":"",W=c$2;for(let Y=0;Y"?(W=G!=null?G:c$2,Q=-1):j[1]===void 0?Q=-2:(Q=W.lastIndex-j[2].length,Z=j[1],W=j[3]===void 0?f$1:j[3]==='"'?m$2:_$1):W===m$2||W===_$1?W=f$1:W===v$1||W===a$2?W=c$2:(W=f$1,G=void 0);const te=W===f$1&&B[Y+1].startsWith("/>")?" ":"";U+=W===c$2?K+n$3:Q>=0?(D.push(Z),K.slice(0,Q)+"$lit$"+K.slice(Q)+e$6+te):K+e$6+(Q===-2?(D.push(void 0),Y):te)}const q=U+(B[F]||"")+(R===2?"":"");if(!Array.isArray(B)||!B.hasOwnProperty("raw"))throw Error("invalid template strings array");return[s$1!==void 0?s$1.createHTML(q):q,D]};class E{constructor({strings:R,_$litType$:F},D){let G;this.parts=[];let U=0,W=0;const q=R.length-1,Y=this.parts,[K,Z]=C(R,F);if(this.el=E.createElement(K,D),A.currentNode=this.el.content,F===2){const j=this.el.content,Q=j.firstChild;Q.remove(),j.append(...Q.childNodes)}for(;(G=A.nextNode())!==null&&Y.length0){G.textContent=i$2?i$2.emptyScript:"";for(let J=0;J2||D[0]!==""||D[1]!==""?(this._$AH=Array(D.length-1).fill(new String),this.strings=D):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(R,F=this,D,G){const U=this.strings;let W=!1;if(U===void 0)R=P(this,R,F,0),W=!r$1(R)||R!==this._$AH&&R!==b,W&&(this._$AH=R);else{const q=R;let Y,K;for(R=U[0],Y=0;YR=>typeof R=="function"?((F,D)=>(window.customElements.define(F,D),D))(B,R):((F,D)=>{const{kind:G,elements:U}=D;return{kind:G,elements:U,finisher(W){window.customElements.define(F,W)}}})(B,R),i$1$1=(B,R)=>R.kind==="method"&&R.descriptor&&!("value"in R.descriptor)?{...R,finisher(F){F.createProperty(R.key,B)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:R.key,initializer(){typeof R.initializer=="function"&&(this[R.key]=R.initializer.call(this))},finisher(F){F.createProperty(R.key,B)}};function e$5(B){return(R,F)=>F!==void 0?((D,G,U)=>{G.constructor.createProperty(U,D)})(B,R,F):i$1$1(B,R);/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const o$1=({finisher:B,descriptor:R})=>(F,D)=>{var G;if(D===void 0){const U=(G=F.originalKey)!==null&&G!==void 0?G:F.key,W=R!=null?{kind:"method",placement:"prototype",key:U,descriptor:R(F.key)}:{...F,key:U};return B!=null&&(W.finisher=function(q){B(q,U)}),W}{const U=F.constructor;R!==void 0&&Object.defineProperty(F,D,R(D)),B==null||B(U,D)}};/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function i$4(B,R){return o$1({descriptor:F=>{const D={get(){var G,U;return(U=(G=this.renderRoot)===null||G===void 0?void 0:G.querySelector(B))!==null&&U!==void 0?U:null},enumerable:!0,configurable:!0};if(R){const G=typeof F=="symbol"?Symbol():"__"+F;D.get=function(){var U,W;return this[G]===void 0&&(this[G]=(W=(U=this.renderRoot)===null||U===void 0?void 0:U.querySelector(B))!==null&&W!==void 0?W:null),this[G]}}return D}})}/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */var n$6;((n$6=window.HTMLSlotElement)===null||n$6===void 0?void 0:n$6.prototype.assignedElements)!=null;var commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function createCommonjsModule(B,R,F){return B(F={path:R,exports:{},require:function(D,G){return commonjsRequire(D,G==null?F.path:G)}},F.exports),F.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var lottie_svg=createCommonjsModule(function(module,exports){typeof navigator!="undefined"&&function(B,R){module.exports=R()}(0,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(B){_useWebWorker=!!B},getWebWorker=function(){return _useWebWorker},setLocationHref=function(B){locationHref=B},getLocationHref=function(){return locationHref};function createTag(B){return document.createElement(B)}function extendPrototype(B,R){var F,D,G=B.length;for(F=0;F1?F[1]=1:F[1]<=0&&(F[1]=0),HSVtoRGB(F[0],F[1],F[2])}function addBrightnessToRGB(B,R){var F=RGBtoHSV(255*B[0],255*B[1],255*B[2]);return F[2]+=R,F[2]>1?F[2]=1:F[2]<0&&(F[2]=0),HSVtoRGB(F[0],F[1],F[2])}function addHueToRGB(B,R){var F=RGBtoHSV(255*B[0],255*B[1],255*B[2]);return F[0]+=R/360,F[0]>1?F[0]-=1:F[0]<0&&(F[0]+=1),HSVtoRGB(F[0],F[1],F[2])}var rgbToHex=function(){var B,R,F=[];for(B=0;B<256;B+=1)R=B.toString(16),F[B]=R.length===1?"0"+R:R;return function(D,G,U){return D<0&&(D=0),G<0&&(G=0),U<0&&(U=0),"#"+F[D]+F[G]+F[U]}}(),setSubframeEnabled=function(B){subframeEnabled=!!B},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(B){expressionsPlugin=B},getExpressionsPlugin=function(){return expressionsPlugin},setDefaultCurveSegments=function(B){defaultCurveSegments=B},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(B){idPrefix=B};function createNS(B){return document.createElementNS(svgNS,B)}function _typeof$5(B){return(_typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R})(B)}var dataManager=function(){var B,R,F=1,D=[],G={onmessage:function(){},postMessage:function(Y){B({data:Y})}},U={postMessage:function(Y){G.onmessage({data:Y})}};function W(){R||((R=function(Y){if(window.Worker&&window.Blob&&getWebWorker()){var K=new Blob(["var _workerSelf = self; self.onmessage = ",Y.toString()],{type:"text/javascript"}),Z=URL.createObjectURL(K);return new Worker(Z)}return B=Y,G}(function(Y){if(U.dataManager||(U.dataManager=function(){function Z(ce,me){var ye,ve,pe,be,xe,ue,_e=ce.length;for(ve=0;ve<_e;ve+=1)if("ks"in(ye=ce[ve])&&!ye.completed){if(ye.completed=!0,ye.tt&&(ce[ve-1].td=ye.tt),ye.hasMask){var Be=ye.masksProperties;for(be=Be.length,pe=0;pe=0;me-=1)if(ce[me].ty==="sh")if(ce[me].ks.k.i)J(ce[me].ks.k);else for(ve=ce[me].ks.k.length,ye=0;yeye[0]||!(ye[0]>ce[0])&&(ce[1]>ye[1]||!(ye[1]>ce[1])&&(ce[2]>ye[2]||!(ye[2]>ce[2])&&null))}var ne,ie=function(){var ce=[4,4,14];function me(ye){var ve,pe,be,xe=ye.length;for(ve=0;ve=0;pe-=1)if(ve[pe].ty==="sh")if(ve[pe].ks.k.i)ve[pe].ks.k.c=ve[pe].closed;else for(xe=ve[pe].ks.k.length,be=0;be500)&&(this._imageLoaded(),clearInterval(K)),Y+=1}.bind(this),50)}function U(q){var Y={assetData:q},K=D(q,this.assetsPath,this.path);return dataManager.loadData(K,function(Z){Y.img=Z,this._footageLoaded()}.bind(this),function(){Y.img={},this._footageLoaded()}.bind(this)),Y}function W(){this._imageLoaded=R.bind(this),this._footageLoaded=F.bind(this),this.testImageLoaded=G.bind(this),this.createFootageData=U.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return W.prototype={loadAssets:function(q,Y){var K;this.imagesLoadedCb=Y;var Z=q.length;for(K=0;Kthis.animationData.op&&(this.animationData.op=B.op,this.totalFrames=Math.floor(B.op-this.animationData.ip));var R,F,D=this.animationData.layers,G=D.length,U=B.layers,W=U.length;for(F=0;Fthis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(this.isLoaded!==!1&&this.renderer)try{this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(B){this.triggerRenderFrameError(B)}},AnimationItem.prototype.play=function(B){B&&this.name!==B||this.isPaused===!0&&(this.isPaused=!1,this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(B){B&&this.name!==B||this.isPaused===!1&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(B){B&&this.name!==B||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(B){B&&this.name!==B||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(B){for(var R,F=0;F=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?R>=this.totalFrames?(this.playCount+=1,this.checkSegments(R%this.totalFrames)||(this.setCurrentRawFrameValue(R%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(R):this.checkSegments(R>this.totalFrames?R%this.totalFrames:0)||(F=!0,R=this.totalFrames-1):R<0?this.checkSegments(R%this.totalFrames)||(!this.loop||this.playCount--<=0&&this.loop!==!0?(F=!0,R=0):(this.setCurrentRawFrameValue(this.totalFrames+R%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(R),F&&(this.setCurrentRawFrameValue(R),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(B,R){this.playCount=0,B[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=B[0]-B[1],this.timeCompleted=this.totalFrames,this.firstFrame=B[1],this.setCurrentRawFrameValue(this.totalFrames-.001-R)):B[1]>B[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=B[1]-B[0],this.timeCompleted=this.totalFrames,this.firstFrame=B[0],this.setCurrentRawFrameValue(.001+R)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(B,R){var F=-1;this.isPaused&&(this.currentRawFrame+this.firstFrameR&&(F=R-B)),this.firstFrame=B,this.totalFrames=R-B,this.timeCompleted=this.totalFrames,F!==-1&&this.goToAndStop(F,!0)},AnimationItem.prototype.playSegments=function(B,R){if(R&&(this.segments.length=0),_typeof$4(B[0])==="object"){var F,D=B.length;for(F=0;F=0;ie-=1)R[ie].animation.destroy(ne)},B.freeze=function(){W=!0},B.unfreeze=function(){W=!1,te()},B.setVolume=function(ne,ie){var re;for(re=0;re=.001?function(re,oe,le,fe){for(var he=0;he<4;++he){var ge=q(oe,le,fe);if(ge===0)return oe;oe-=(W(oe,le,fe)-re)/ge}return oe}(K,ne,Z,j):ie===0?ne:function(re,oe,le,fe,he){var ge,ce,me=0;do(ge=W(ce=oe+(le-oe)/2,fe,he)-re)>0?le=ce:oe=ce;while(Math.abs(ge)>1e-7&&++me<10);return ce}(K,J,J+.1,Z,j)}},B}(),pooling={double:function(B){return B.concat(createSizedArray(B.length))}},poolFactory=function(B,R,F){var D=0,G=B,U=createSizedArray(G);return{newElement:function(){return D?U[D-=1]:R()},release:function(W){D===G&&(U=pooling.double(U),G*=2),F&&F(W),U[D]=W,D+=1}}},bezierLengthPool=poolFactory(8,function(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}),segmentsLengthPool=poolFactory(8,function(){return{lengths:[],totalLength:0}},function(B){var R,F=B.lengths.length;for(R=0;R-.001&&ne<.001}var F=function(K,Z,j,Q){var J,te,ne,ie,re,oe,le=getDefaultCurveSegments(),fe=0,he=[],ge=[],ce=bezierLengthPool.newElement();for(ne=j.length,J=0;Jne?-1:1,oe=!0;oe;)if(Q[te]<=ne&&Q[te+1]>ne?(ie=(ne-Q[te])/(Q[te+1]-Q[te]),oe=!1):te+=re,te<0||te>=J-1){if(te===J-1)return j[te];oe=!1}return j[te]+(j[te+1]-j[te])*ie}var Y=createTypedArray("float32",8);return{getSegmentsLength:function(K){var Z,j=segmentsLengthPool.newElement(),Q=K.c,J=K.v,te=K.o,ne=K.i,ie=K._length,re=j.lengths,oe=0;for(Z=0;Z1&&(J=1);var ie,re=q(J,ne),oe=q(te=te>1?1:te,ne),le=K.length,fe=1-re,he=1-oe,ge=fe*fe*fe,ce=re*fe*fe*3,me=re*re*fe*3,ye=re*re*re,ve=fe*fe*he,pe=re*fe*he+fe*re*he+fe*fe*oe,be=re*re*he+fe*re*oe+re*fe*oe,xe=re*re*oe,ue=fe*he*he,_e=re*he*he+fe*oe*he+fe*he*oe,Be=re*oe*he+fe*oe*oe+re*he*oe,Ae=re*oe*oe,Pe=he*he*he,Ie=oe*he*he+he*oe*he+he*he*oe,Ce=oe*oe*he+he*oe*oe+oe*he*oe,Te=oe*oe*oe;for(ie=0;iefe?le>he?le-fe-he:he-fe-le:he>fe?he-fe-le:fe-le-he)>-1e-4&&oe<1e-4}}}var bez=bezFunction(),PropertyFactory=function(){var B=initialDefaultFrame,R=Math.abs;function F(Q,J){var te,ne=this.offsetTime;this.propType==="multidimensional"&&(te=createTypedArray("float32",this.pv.length));for(var ie,re,oe,le,fe,he,ge,ce,me,ye=J.lastIndex,ve=ye,pe=this.keyframes.length-1,be=!0;be;){if(ie=this.keyframes[ve],re=this.keyframes[ve+1],ve===pe-1&&Q>=re.t-ne){ie.h&&(ie=re),ye=0;break}if(re.t-ne>Q){ye=ve;break}ve=ue||Q<_e){var Ae=Q>=ue?Be.points.length-1:0;for(fe=Be.points[Ae].point.length,le=0;le=Ce&&Ie=ue?(te[0]=xe[0],te[1]=xe[1],te[2]=xe[2]):Q<=_e?(te[0]=ie.s[0],te[1]=ie.s[1],te[2]=ie.s[2]):function($e,We){var Ve=We[0],qe=We[1],et=We[2],ot=We[3],ft=Math.atan2(2*qe*ot-2*Ve*et,1-2*qe*qe-2*et*et),lt=Math.asin(2*Ve*qe+2*et*ot),Ee=Math.atan2(2*Ve*ot-2*qe*et,1-2*Ve*Ve-2*et*et);$e[0]=ft/degToRads,$e[1]=lt/degToRads,$e[2]=Ee/degToRads}(te,function($e,We,Ve){var qe,et,ot,ft,lt,Ee=[],je=$e[0],Ke=$e[1],Oe=$e[2],Fe=$e[3],He=We[0],Qe=We[1],tt=We[2],Xe=We[3];return(et=je*He+Ke*Qe+Oe*tt+Fe*Xe)<0&&(et=-et,He=-He,Qe=-Qe,tt=-tt,Xe=-Xe),1-et>1e-6?(qe=Math.acos(et),ot=Math.sin(qe),ft=Math.sin((1-Ve)*qe)/ot,lt=Math.sin(Ve*qe)/ot):(ft=1-Ve,lt=Ve),Ee[0]=ft*je+lt*He,Ee[1]=ft*Ke+lt*Qe,Ee[2]=ft*Oe+lt*tt,Ee[3]=ft*Fe+lt*Xe,Ee}(D(ie.s),D(xe),(Q-_e)/(ue-_e)));else for(ve=0;ve=ue?he=1:Q<_e?he=0:(ie.o.x.constructor===Array?(oe.__fnct||(oe.__fnct=[]),oe.__fnct[ve]?me=oe.__fnct[ve]:(Te=ie.o.x[ve]===void 0?ie.o.x[0]:ie.o.x[ve],Se=ie.o.y[ve]===void 0?ie.o.y[0]:ie.o.y[ve],Ne=ie.i.x[ve]===void 0?ie.i.x[0]:ie.i.x[ve],Ge=ie.i.y[ve]===void 0?ie.i.y[0]:ie.i.y[ve],me=BezierFactory.getBezierEasing(Te,Se,Ne,Ge).get,oe.__fnct[ve]=me)):oe.__fnct?me=oe.__fnct:(Te=ie.o.x,Se=ie.o.y,Ne=ie.i.x,Ge=ie.i.y,me=BezierFactory.getBezierEasing(Te,Se,Ne,Ge).get,ie.keyframeMetadata=me),he=me((Q-_e)/(ue-_e)))),xe=re.s||ie.e,ke=ie.h===1?ie.s[ve]:ie.s[ve]+(xe[ve]-ie.s[ve])*he,this.propType==="multidimensional"?te[ve]=ke:te=ke}return J.lastIndex=ye,te}function D(Q){var J=Q[0]*degToRads,te=Q[1]*degToRads,ne=Q[2]*degToRads,ie=Math.cos(J/2),re=Math.cos(te/2),oe=Math.cos(ne/2),le=Math.sin(J/2),fe=Math.sin(te/2),he=Math.sin(ne/2);return[le*fe*oe+ie*re*he,le*re*oe+ie*fe*he,ie*fe*oe-le*re*he,ie*re*oe-le*fe*he]}function G(){var Q=this.comp.renderedFrame-this.offsetTime,J=this.keyframes[0].t-this.offsetTime,te=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(Q===this._caching.lastFrame||this._caching.lastFrame!==B&&(this._caching.lastFrame>=te&&Q>=te||this._caching.lastFrame=Q&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var ne=this.interpolateValue(Q,this._caching);this.pv=ne}return this._caching.lastFrame=Q,this.pv}function U(Q){var J;if(this.propType==="unidimensional")J=Q*this.mult,R(this.v-J)>1e-5&&(this.v=J,this._mdf=!0);else for(var te=0,ne=this.v.length;te1e-5&&(this.v[te]=J,this._mdf=!0),te+=1}function W(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var Q;this.lock=!0,this._mdf=this._isFirstFrame;var J=this.effectsSequence.length,te=this.kf?this.pv:this.data.k;for(Q=0;Q=this._maxLength&&this.doubleArrayLength(),F){case"v":U=this.v;break;case"i":U=this.i;break;case"o":U=this.o;break;default:U=[]}(!U[D]||U[D]&&!G)&&(U[D]=pointPool.newElement()),U[D][0]=B,U[D][1]=R},ShapePath.prototype.setTripleAt=function(B,R,F,D,G,U,W,q){this.setXYAt(B,R,"v",W,q),this.setXYAt(F,D,"o",W,q),this.setXYAt(G,U,"i",W,q)},ShapePath.prototype.reverse=function(){var B=new ShapePath;B.setPathData(this.c,this._length);var R=this.v,F=this.o,D=this.i,G=0;this.c&&(B.setTripleAt(R[0][0],R[0][1],D[0][0],D[0][1],F[0][0],F[0][1],0,!1),G=1);var U,W=this._length-1,q=this._length;for(U=G;U=ye[ye.length-1].t-this.offsetTime)ne=ye[ye.length-1].s?ye[ye.length-1].s[0]:ye[ye.length-2].e[0],re=!0;else{for(var ve,pe,be,xe=me,ue=ye.length-1,_e=!0;_e&&(ve=ye[xe],!((pe=ye[xe+1]).t-this.offsetTime>Q));)xe=pe.t-this.offsetTime)ge=1;else if(Qte&&Q>te)||(this._caching.lastIndex=ne0||Ae>-1e-6&&Ae<0?D(1e4*Ae)/1e4:Ae}function Be(){var Ae=this.props;return"matrix("+_e(Ae[0])+","+_e(Ae[1])+","+_e(Ae[4])+","+_e(Ae[5])+","+_e(Ae[12])+","+_e(Ae[13])+")"}return function(){this.reset=G,this.rotate=U,this.rotateX=W,this.rotateY=q,this.rotateZ=Y,this.skew=Z,this.skewFromAxis=j,this.shear=K,this.scale=Q,this.setTransform=J,this.translate=te,this.transform=ne,this.applyToPoint=fe,this.applyToX=he,this.applyToY=ge,this.applyToZ=ce,this.applyToPointArray=be,this.applyToTriplePoints=pe,this.applyToPointStringified=xe,this.toCSS=ue,this.to2dCSS=Be,this.clone=oe,this.cloneFromProps=le,this.equals=re,this.inversePoints=ve,this.inversePoint=ye,this.getInverseMatrix=me,this._t=this.transform,this.isIdentity=ie,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(B){return(_typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R})(B)}var lottie={},standalone="__[STANDALONE]__",queryString;function setLocation(B){setLocationHref(B)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(B){setSubframeEnabled(B)}function setPrefix(B){setIdPrefix(B)}function loadAnimation(B){return animationManager.loadAnimation(B)}function setQuality(B){if(typeof B=="string")switch(B){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10)}else!isNaN(B)&&B>1&&setDefaultCurveSegments(B)}function inBrowser(){return typeof navigator!="undefined"}function installPlugin(B,R){B==="expressions"&&setExpressionsPlugin(R)}function getFactory(B){switch(B){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(B){for(var R=queryString.split("&"),F=0;F=1?U.push({s:B-1,e:R-1}):(U.push({s:B,e:1}),U.push({s:0,e:R-1}));var W,q,Y=[],K=U.length;for(W=0;WD+F||(Z=q.s*G<=D?0:(q.s*G-D)/F,j=q.e*G>=D+F?1:(q.e*G-D)/F,Y.push([Z,j]))}return Y.length||Y.push([0,0]),Y},TrimModifier.prototype.releasePathsData=function(B){var R,F=B.length;for(R=0;R1?1+U:this.s.v<0?0+U:this.s.v+U)>(F=this.e.v>1?1+U:this.e.v<0?0+U:this.e.v+U)){var W=R;R=F,F=W}R=1e-4*Math.round(1e4*R),F=1e-4*Math.round(1e4*F),this.sValue=R,this.eValue=F}else R=this.sValue,F=this.eValue;var q,Y,K,Z,j,Q=this.shapes.length,J=0;if(F===R)for(G=0;G=0;G-=1)if((te=this.shapes[G]).shape._mdf){for((ne=te.localShapeCollection).releaseShapes(),this.m===2&&Q>1?(re=this.calculateShapeEdges(R,F,te.totalShapeLength,fe,J),fe+=te.totalShapeLength):re=[[oe,le]],Y=re.length,q=0;q=1?ie.push({s:te.totalShapeLength*(oe-1),e:te.totalShapeLength*(le-1)}):(ie.push({s:te.totalShapeLength*oe,e:te.totalShapeLength}),ie.push({s:0,e:te.totalShapeLength*(le-1)}));var he=this.addShapes(te,ie[0]);if(ie[0].s!==ie[0].e){if(ie.length>1)if(te.shape.paths.shapes[te.shape.paths._length-1].c){var ge=he.pop();this.addPaths(he,ne),he=this.addShapes(te,ie[1],ge)}else this.addPaths(he,ne),he=this.addShapes(te,ie[1]);this.addPaths(he,ne)}}te.shape.paths=ne}}},TrimModifier.prototype.addPaths=function(B,R){var F,D=B.length;for(F=0;FR.e){F.c=!1;break}R.s<=te&&R.e>=te+W.addedLength?(this.addSegment(Q[D].v[G-1],Q[D].o[G-1],Q[D].i[G],Q[D].v[G],F,q,ie),ie=!1):(K=bez.getNewSegment(Q[D].v[G-1],Q[D].v[G],Q[D].o[G-1],Q[D].i[G],(R.s-te)/W.addedLength,(R.e-te)/W.addedLength,Y[G-1]),this.addSegmentFromArray(K,F,q,ie),ie=!1,F.c=!1),te+=W.addedLength,q+=1}if(Q[D].c&&Y.length){if(W=Y[G-1],te<=R.e){var re=Y[G-1].addedLength;R.s<=te&&R.e>=te+re?(this.addSegment(Q[D].v[G-1],Q[D].o[G-1],Q[D].i[0],Q[D].v[0],F,q,ie),ie=!1):(K=bez.getNewSegment(Q[D].v[G-1],Q[D].v[0],Q[D].o[G-1],Q[D].i[0],(R.s-te)/re,(R.e-te)/re,Y[G-1]),this.addSegmentFromArray(K,F,q,ie),ie=!1,F.c=!1)}else F.c=!1;te+=W.addedLength,q+=1}if(F._length&&(F.setXYAt(F.v[Z][0],F.v[Z][1],"i",Z),F.setXYAt(F.v[F._length-1][0],F.v[F._length-1][1],"o",F._length-1)),te>R.e)break;D=this.p.keyframes[this.p.keyframes.length-1].t?(G=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/D,0),U=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/D,0)):(G=this.p.pv,U=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/D,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){G=[],U=[];var W=this.px,q=this.py;W._caching.lastFrame+W.offsetTime<=W.keyframes[0].t?(G[0]=W.getValueAtTime((W.keyframes[0].t+.01)/D,0),G[1]=q.getValueAtTime((q.keyframes[0].t+.01)/D,0),U[0]=W.getValueAtTime(W.keyframes[0].t/D,0),U[1]=q.getValueAtTime(q.keyframes[0].t/D,0)):W._caching.lastFrame+W.offsetTime>=W.keyframes[W.keyframes.length-1].t?(G[0]=W.getValueAtTime(W.keyframes[W.keyframes.length-1].t/D,0),G[1]=q.getValueAtTime(q.keyframes[q.keyframes.length-1].t/D,0),U[0]=W.getValueAtTime((W.keyframes[W.keyframes.length-1].t-.01)/D,0),U[1]=q.getValueAtTime((q.keyframes[q.keyframes.length-1].t-.01)/D,0)):(G=[W.pv,q.pv],U[0]=W.getValueAtTime((W._caching.lastFrame+W.offsetTime-.01)/D,W.offsetTime),U[1]=q.getValueAtTime((q._caching.lastFrame+q.offsetTime-.01)/D,q.offsetTime))}else G=U=B;this.v.rotate(-Math.atan2(G[1]-U[1],G[0]-U[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}},precalculateMatrix:function(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],R),R.prototype.addDynamicProperty=function(F){this._addDynamicProperty(F),this.elem.addDynamicProperty(F),this._isDirty=!0},R.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(F,D,G){return new R(F,D,G)}}}();function RepeaterModifier(){}function RoundCornersModifier(){}function getFontProperties(B){for(var R=B.fStyle?B.fStyle.split(" "):[],F="normal",D="normal",G=R.length,U=0;U0;)F-=1,this._elements.unshift(R[F]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(B){var R,F=B.length;for(R=0;R0?Math.floor(Q):Math.ceil(Q),ne=this.pMatrix.props,ie=this.rMatrix.props,re=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var oe,le,fe=0;if(Q>0){for(;fete;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),fe-=1;J&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-J,!0),fe-=J)}for(D=this.data.m===1?0:this._currentCopies-1,G=this.data.m===1?1:-1,U=this._currentCopies;U;){if(le=(F=(R=this.elemsData[D].it)[R.length-1].transform.mProps.v.props).length,R[R.length-1].transform.mProps._mdf=!0,R[R.length-1].transform.op._mdf=!0,R[R.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(D/(this._currentCopies-1)),fe!==0){for((D!==0&&G===1||D!==this._currentCopies-1&&G===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(ie[0],ie[1],ie[2],ie[3],ie[4],ie[5],ie[6],ie[7],ie[8],ie[9],ie[10],ie[11],ie[12],ie[13],ie[14],ie[15]),this.matrix.transform(re[0],re[1],re[2],re[3],re[4],re[5],re[6],re[7],re[8],re[9],re[10],re[11],re[12],re[13],re[14],re[15]),this.matrix.transform(ne[0],ne[1],ne[2],ne[3],ne[4],ne[5],ne[6],ne[7],ne[8],ne[9],ne[10],ne[11],ne[12],ne[13],ne[14],ne[15]),oe=0;oe0&&(ne=!1),ne){var ie=createTag("style");ie.setAttribute("f-forigin",Z[K].fOrigin),ie.setAttribute("f-origin",Z[K].origin),ie.setAttribute("f-family",Z[K].fFamily),ie.type="text/css",ie.innerText="@font-face {font-family: "+Z[K].fFamily+"; font-style: normal; src: url('"+Z[K].fPath+"');}",Y.appendChild(ie)}}else if(Z[K].fOrigin==="g"||Z[K].origin===1){for(J=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),te=0;teB?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var B,R=this.renderableComponents.length;for(B=0;B0&&(this.maskElement.setAttribute("id",ie),this.element.maskedElement.setAttribute(oe,"url("+getLocationHref()+"#"+ie+")"),U.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){this.layerInterface=FootageInterface(this)},FootageElement.prototype.getFootageData=function(){return this.footageData},AudioElement.prototype.prepareFrame=function(B){if(this.prepareRenderableFrame(B,!0),this.prepareProperties(B,!0),this.tm._placeholder)this._currentTime=B/this.data.sr;else{var R=this.tm.v;this._currentTime=R}},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(B){this.audio.rate(B)},AudioElement.prototype.volume=function(B){this.audio.volume(B)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){},BaseRenderer.prototype.checkLayers=function(B){var R,F,D=this.layers.length;for(this.completeLayers=!0,R=D-1;R>=0;R-=1)this.elements[R]||(F=this.layers[R]).ip-F.st<=B-this.layers[R].st&&F.op-F.st>B-this.layers[R].st&&this.buildItem(R),this.completeLayers=!!this.elements[R]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(B){switch(B.ty){case 2:return this.createImage(B);case 0:return this.createComp(B);case 1:return this.createSolid(B);case 3:return this.createNull(B);case 4:return this.createShape(B);case 5:return this.createText(B);case 6:return this.createAudio(B);case 13:return this.createCamera(B);case 15:return this.createFootage(B);default:return this.createNull(B)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(B){return new AudioElement(B,this.globalData,this)},BaseRenderer.prototype.createFootage=function(B){return new FootageElement(B,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var B,R=this.layers.length;for(B=0;B1&&(U+=" C"+R.o[D-1][0]+","+R.o[D-1][1]+" "+R.i[0][0]+","+R.i[0][1]+" "+R.v[0][0]+","+R.v[0][1]),F.lastPath!==U){var W="";F.elem&&(R.c&&(W=B.inv?this.solidPath+U:U),F.elem.setAttribute("d",W)),F.lastPath=U}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var B={};return B.createFilter=function(R,F){var D=createNS("filter");return D.setAttribute("id",R),F!==!0&&(D.setAttribute("filterUnits","objectBoundingBox"),D.setAttribute("x","0%"),D.setAttribute("y","0%"),D.setAttribute("width","100%"),D.setAttribute("height","100%")),D},B.createAlphaToLuminanceFilter=function(){var R=createNS("feColorMatrix");return R.setAttribute("type","matrix"),R.setAttribute("color-interpolation-filters","sRGB"),R.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),R},B}(),featureSupport=function(){var B={maskType:!0};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(B.maskType=!1),B}();function SVGTintFilter(B,R){this.filterManager=R;var F=createNS("feColorMatrix");if(F.setAttribute("type","matrix"),F.setAttribute("color-interpolation-filters","linearRGB"),F.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),F.setAttribute("result","f1"),B.appendChild(F),(F=createNS("feColorMatrix")).setAttribute("type","matrix"),F.setAttribute("color-interpolation-filters","sRGB"),F.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),F.setAttribute("result","f2"),B.appendChild(F),this.matrixFilter=F,R.effectElements[2].p.v!==100||R.effectElements[2].p.k){var D,G=createNS("feMerge");B.appendChild(G),(D=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),G.appendChild(D),(D=createNS("feMergeNode")).setAttribute("in","f2"),G.appendChild(D)}}function SVGFillFilter(B,R){this.filterManager=R;var F=createNS("feColorMatrix");F.setAttribute("type","matrix"),F.setAttribute("color-interpolation-filters","sRGB"),F.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),B.appendChild(F),this.matrixFilter=F}function SVGStrokeEffect(B,R){this.initialized=!1,this.filterManager=R,this.elem=B,this.paths=[]}function SVGTritoneFilter(B,R){this.filterManager=R;var F=createNS("feColorMatrix");F.setAttribute("type","matrix"),F.setAttribute("color-interpolation-filters","linearRGB"),F.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),F.setAttribute("result","f1"),B.appendChild(F);var D=createNS("feComponentTransfer");D.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(D),this.matrixFilter=D;var G=createNS("feFuncR");G.setAttribute("type","table"),D.appendChild(G),this.feFuncR=G;var U=createNS("feFuncG");U.setAttribute("type","table"),D.appendChild(U),this.feFuncG=U;var W=createNS("feFuncB");W.setAttribute("type","table"),D.appendChild(W),this.feFuncB=W}function SVGProLevelsFilter(B,R){this.filterManager=R;var F=this.filterManager.effectElements,D=createNS("feComponentTransfer");(F[10].p.k||F[10].p.v!==0||F[11].p.k||F[11].p.v!==1||F[12].p.k||F[12].p.v!==1||F[13].p.k||F[13].p.v!==0||F[14].p.k||F[14].p.v!==1)&&(this.feFuncR=this.createFeFunc("feFuncR",D)),(F[17].p.k||F[17].p.v!==0||F[18].p.k||F[18].p.v!==1||F[19].p.k||F[19].p.v!==1||F[20].p.k||F[20].p.v!==0||F[21].p.k||F[21].p.v!==1)&&(this.feFuncG=this.createFeFunc("feFuncG",D)),(F[24].p.k||F[24].p.v!==0||F[25].p.k||F[25].p.v!==1||F[26].p.k||F[26].p.v!==1||F[27].p.k||F[27].p.v!==0||F[28].p.k||F[28].p.v!==1)&&(this.feFuncB=this.createFeFunc("feFuncB",D)),(F[31].p.k||F[31].p.v!==0||F[32].p.k||F[32].p.v!==1||F[33].p.k||F[33].p.v!==1||F[34].p.k||F[34].p.v!==0||F[35].p.k||F[35].p.v!==1)&&(this.feFuncA=this.createFeFunc("feFuncA",D)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(D.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(D),D=createNS("feComponentTransfer")),(F[3].p.k||F[3].p.v!==0||F[4].p.k||F[4].p.v!==1||F[5].p.k||F[5].p.v!==1||F[6].p.k||F[6].p.v!==0||F[7].p.k||F[7].p.v!==1)&&(D.setAttribute("color-interpolation-filters","sRGB"),B.appendChild(D),this.feFuncRComposed=this.createFeFunc("feFuncR",D),this.feFuncGComposed=this.createFeFunc("feFuncG",D),this.feFuncBComposed=this.createFeFunc("feFuncB",D))}function SVGDropShadowEffect(B,R){var F=R.container.globalData.renderConfig.filterSize;B.setAttribute("x",F.x),B.setAttribute("y",F.y),B.setAttribute("width",F.width),B.setAttribute("height",F.height),this.filterManager=R;var D=createNS("feGaussianBlur");D.setAttribute("in","SourceAlpha"),D.setAttribute("result","drop_shadow_1"),D.setAttribute("stdDeviation","0"),this.feGaussianBlur=D,B.appendChild(D);var G=createNS("feOffset");G.setAttribute("dx","25"),G.setAttribute("dy","0"),G.setAttribute("in","drop_shadow_1"),G.setAttribute("result","drop_shadow_2"),this.feOffset=G,B.appendChild(G);var U=createNS("feFlood");U.setAttribute("flood-color","#00ff00"),U.setAttribute("flood-opacity","1"),U.setAttribute("result","drop_shadow_3"),this.feFlood=U,B.appendChild(U);var W=createNS("feComposite");W.setAttribute("in","drop_shadow_3"),W.setAttribute("in2","drop_shadow_2"),W.setAttribute("operator","in"),W.setAttribute("result","drop_shadow_4"),B.appendChild(W);var q,Y=createNS("feMerge");B.appendChild(Y),q=createNS("feMergeNode"),Y.appendChild(q),(q=createNS("feMergeNode")).setAttribute("in","SourceGraphic"),this.feMergeNode=q,this.feMerge=Y,this.originalNodeAdded=!1,Y.appendChild(q)}SVGTintFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var R=this.filterManager.effectElements[0].p.v,F=this.filterManager.effectElements[1].p.v,D=this.filterManager.effectElements[2].p.v/100;this.matrixFilter.setAttribute("values",F[0]-R[0]+" 0 0 0 "+R[0]+" "+(F[1]-R[1])+" 0 0 0 "+R[1]+" "+(F[2]-R[2])+" 0 0 0 "+R[2]+" 0 0 0 "+D+" 0")}},SVGFillFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var R=this.filterManager.effectElements[2].p.v,F=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+R[0]+" 0 0 0 0 "+R[1]+" 0 0 0 0 "+R[2]+" 0 0 0 "+F+" 0")}},SVGStrokeEffect.prototype.initialize=function(){var B,R,F,D,G=this.elem.layerElement.children||this.elem.layerElement.childNodes;for(this.filterManager.effectElements[1].p.v===1?(D=this.elem.maskManager.masksProperties.length,F=0):D=(F=this.filterManager.effectElements[0].p.v-1)+1,(R=createNS("g")).setAttribute("fill","none"),R.setAttribute("stroke-linecap","round"),R.setAttribute("stroke-dashoffset",1);F=K?J<0?D:G:D+Q*Math.pow((U-B)/J,1/F),Z[j]=W,j+=1,q+=256/255;return Z.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){var R,F=this.filterManager.effectElements;this.feFuncRComposed&&(B||F[3].p._mdf||F[4].p._mdf||F[5].p._mdf||F[6].p._mdf||F[7].p._mdf)&&(R=this.getTableValue(F[3].p.v,F[4].p.v,F[5].p.v,F[6].p.v,F[7].p.v),this.feFuncRComposed.setAttribute("tableValues",R),this.feFuncGComposed.setAttribute("tableValues",R),this.feFuncBComposed.setAttribute("tableValues",R)),this.feFuncR&&(B||F[10].p._mdf||F[11].p._mdf||F[12].p._mdf||F[13].p._mdf||F[14].p._mdf)&&(R=this.getTableValue(F[10].p.v,F[11].p.v,F[12].p.v,F[13].p.v,F[14].p.v),this.feFuncR.setAttribute("tableValues",R)),this.feFuncG&&(B||F[17].p._mdf||F[18].p._mdf||F[19].p._mdf||F[20].p._mdf||F[21].p._mdf)&&(R=this.getTableValue(F[17].p.v,F[18].p.v,F[19].p.v,F[20].p.v,F[21].p.v),this.feFuncG.setAttribute("tableValues",R)),this.feFuncB&&(B||F[24].p._mdf||F[25].p._mdf||F[26].p._mdf||F[27].p._mdf||F[28].p._mdf)&&(R=this.getTableValue(F[24].p.v,F[25].p.v,F[26].p.v,F[27].p.v,F[28].p.v),this.feFuncB.setAttribute("tableValues",R)),this.feFuncA&&(B||F[31].p._mdf||F[32].p._mdf||F[33].p._mdf||F[34].p._mdf||F[35].p._mdf)&&(R=this.getTableValue(F[31].p.v,F[32].p.v,F[33].p.v,F[34].p.v,F[35].p.v),this.feFuncA.setAttribute("tableValues",R))}},SVGDropShadowEffect.prototype.renderFrame=function(B){if(B||this.filterManager._mdf){if((B||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),B||this.filterManager.effectElements[0].p._mdf){var R=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(255*R[0]),Math.round(255*R[1]),Math.round(255*R[2])))}if((B||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),B||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var F=this.filterManager.effectElements[3].p.v,D=(this.filterManager.effectElements[2].p.v-90)*degToRads,G=F*Math.cos(D),U=F*Math.sin(D);this.feOffset.setAttribute("dx",G),this.feOffset.setAttribute("dy",U)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(B,R,F){this.initialized=!1,this.filterManager=R,this.filterElem=B,this.elem=F,F.matteElement=createNS("g"),F.matteElement.appendChild(F.layerElement),F.matteElement.appendChild(F.transformedElement),F.baseElement=F.matteElement}function SVGGaussianBlurEffect(B,R){B.setAttribute("x","-100%"),B.setAttribute("y","-100%"),B.setAttribute("width","300%"),B.setAttribute("height","300%"),this.filterManager=R;var F=createNS("feGaussianBlur");B.appendChild(F),this.feGaussianBlur=F}SVGMatte3Effect.prototype.findSymbol=function(B){for(var R=0,F=_svgMatteSymbols.length;R=0&&!this.shapeModifiers[B].processShapes(this._isFirstFrame);B-=1);}},searchProcessedElement:function(B){for(var R=this.processedElements,F=0,D=R.length;F.01)return!1;F+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var B=0,R=this.data.k.k.length;B0;)ne=Z.transformers[ge].mProps._mdf||ne,he-=1,ge-=1;if(ne)for(he=me-Z.styles[re].lvl,ge=Z.transformers.length-1;he>0;)fe=Z.transformers[ge].mProps.v.props,le.transform(fe[0],fe[1],fe[2],fe[3],fe[4],fe[5],fe[6],fe[7],fe[8],fe[9],fe[10],fe[11],fe[12],fe[13],fe[14],fe[15]),he-=1,ge-=1}else le=B;if(J=(oe=Z.sh.paths)._length,ne){for(te="",Q=0;Q=1?pe=.99:pe<=-1&&(pe=-.99);var be=ie*pe,xe=Math.cos(ve+Z.a.v)*be+le[0],ue=Math.sin(ve+Z.a.v)*be+le[1];re.setAttribute("fx",xe),re.setAttribute("fy",ue),oe&&!Z.g._collapsable&&(Z.of.setAttribute("fx",xe),Z.of.setAttribute("fy",ue))}}function Y(K,Z,j){var Q=Z.style,J=Z.d;J&&(J._mdf||j)&&J.dashStr&&(Q.pElem.setAttribute("stroke-dasharray",J.dashStr),Q.pElem.setAttribute("stroke-dashoffset",J.dashoffset[0])),Z.c&&(Z.c._mdf||j)&&Q.pElem.setAttribute("stroke","rgb("+bmFloor(Z.c.v[0])+","+bmFloor(Z.c.v[1])+","+bmFloor(Z.c.v[2])+")"),(Z.o._mdf||j)&&Q.pElem.setAttribute("stroke-opacity",Z.o.v),(Z.w._mdf||j)&&(Q.pElem.setAttribute("stroke-width",Z.w.v),Q.msElem&&Q.msElem.setAttribute("stroke-width",Z.w.v))}return{createRenderFunction:function(K){switch(K.ty){case"fl":return U;case"gf":return q;case"gs":return W;case"st":return Y;case"sh":case"el":case"rc":case"sr":return G;case"tr":return F;case"no":return D;default:return null}}}}();function SVGShapeElement(B,R,F){this.shapes=[],this.shapesData=B.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(B,R,F),this.prevViewData=[]}function LetterProps(B,R,F,D,G,U){this.o=B,this.sw=R,this.sc=F,this.fc=D,this.m=G,this.p=U,this._mdf={o:!0,sw:!!R,sc:!!F,fc:!!D,m:!0,p:!0}}function TextProperty(B,R){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,this.data=R,this.elem=B,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var B,R,F,D,G=this.shapes.length,U=this.stylesList.length,W=[],q=!1;for(F=0;F1&&q&&this.setShapesAsAnimated(W)}},SVGShapeElement.prototype.setShapesAsAnimated=function(B){var R,F=B.length;for(R=0;R=0;q-=1){if((Q=this.searchProcessedElement(B[q]))?R[q]=F[Q-1]:B[q]._render=W,B[q].ty==="fl"||B[q].ty==="st"||B[q].ty==="gf"||B[q].ty==="gs"||B[q].ty==="no")Q?R[q].style.closed=!1:R[q]=this.createStyleElement(B[q],G),B[q]._render&&R[q].style.pElem.parentNode!==D&&D.appendChild(R[q].style.pElem),ne.push(R[q].style);else if(B[q].ty==="gr"){if(Q)for(K=R[q].it.length,Y=0;Y1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(B){this.effectsSequence.push(B),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(B){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||B){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var R=this.currentData,F=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var D;this.lock=!0,this._mdf=!1;var G=this.effectsSequence.length,U=B||this.data.d.k[this.keysIndex].s;for(D=0;DR);)F+=1;return this.keysIndex!==F&&(this.keysIndex=F),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(B){for(var R,F,D=[],G=0,U=B.length,W=!1;G=55296&&R<=56319?(F=B.charCodeAt(G+1))>=56320&&F<=57343?(W||FontManager.isModifier(R,F)?(D[D.length-1]+=B.substr(G,2),W=!1):D.push(B.substr(G,2)),G+=1):D.push(B.charAt(G)):R>56319?(F=B.charCodeAt(G+1),FontManager.isZeroWidthJoiner(R,F)?(W=!0,D[D.length-1]+=B.substr(G,2),G+=1):D.push(B.charAt(G))):FontManager.isZeroWidthJoiner(R)?(D[D.length-1]+=B.charAt(G),W=!0):D.push(B.charAt(G)),G+=1;return D},TextProperty.prototype.completeTextData=function(B){B.__complete=!0;var R,F,D,G,U,W,q,Y=this.elem.globalData.fontManager,K=this.data,Z=[],j=0,Q=K.m.g,J=0,te=0,ne=0,ie=[],re=0,oe=0,le=Y.getFontByName(B.f),fe=0,he=getFontProperties(le);B.fWeight=he.weight,B.fStyle=he.style,B.finalSize=B.s,B.finalText=this.buildFinalText(B.t),F=B.finalText.length,B.finalLineHeight=B.lh;var ge,ce=B.tr/1e3*B.finalSize;if(B.sz)for(var me,ye,ve=!0,pe=B.sz[0],be=B.sz[1];ve;){me=0,re=0,F=(ye=this.buildFinalText(B.t)).length,ce=B.tr/1e3*B.finalSize;var xe=-1;for(R=0;Rpe&&ye[R]!==" "?(xe===-1?F+=1:R=xe,me+=B.finalLineHeight||1.2*B.finalSize,ye.splice(R,xe===R?1:0,"\r"),xe=-1,re=0):(re+=fe,re+=ce);me+=le.ascent*B.finalSize/100,this.canResize&&B.finalSize>this.minimumFontSize&&beoe?re:oe,re=-2*ce,G="",D=!0,ne+=1):G=ue,Y.chars?(q=Y.getCharData(ue,le.fStyle,Y.getFontByName(B.f).fFamily),fe=D?0:q.w*B.finalSize/100):fe=Y.measureText(G,B.f,B.finalSize),ue===" "?_e+=fe+ce:(re+=fe+ce+_e,_e=0),Z.push({l:fe,an:fe,add:J,n:D,anIndexes:[],val:G,line:ne,animatorJustifyOffset:0}),Q==2){if(J+=fe,G===""||G===" "||R===F-1){for(G!==""&&G!==" "||(J-=fe);te<=R;)Z[te].an=J,Z[te].ind=j,Z[te].extra=fe,te+=1;j+=1,J=0}}else if(Q==3){if(J+=fe,G===""||R===F-1){for(G===""&&(J-=fe);te<=R;)Z[te].an=J,Z[te].ind=j,Z[te].extra=fe,te+=1;J=0,j+=1}}else Z[j].ind=j,Z[j].extra=0,j+=1;if(B.l=Z,oe=re>oe?re:oe,ie.push(re),B.sz)B.boxWidth=B.sz[0],B.justifyOffset=0;else switch(B.boxWidth=oe,B.j){case 1:B.justifyOffset=-B.boxWidth;break;case 2:B.justifyOffset=-B.boxWidth/2;break;default:B.justifyOffset=0}B.lineWidths=ie;var Be,Ae,Pe,Ie,Ce=K.a;W=Ce.length;var Te=[];for(U=0;U0?U=this.ne.v/100:W=-this.ne.v/100,this.xe.v>0?q=1-this.xe.v/100:Y=1+this.xe.v/100;var K=BezierFactory.getBezierEasing(U,W,q,Y).get,Z=0,j=this.finalS,Q=this.finalE,J=this.data.sh;if(J===2)Z=K(Z=Q===j?G>=Q?1:0:B(0,R(.5/(Q-j)+(G-j)/(Q-j),1)));else if(J===3)Z=K(Z=Q===j?G>=Q?0:1:1-B(0,R(.5/(Q-j)+(G-j)/(Q-j),1)));else if(J===4)Q===j?Z=0:(Z=B(0,R(.5/(Q-j)+(G-j)/(Q-j),1)))<.5?Z*=2:Z=1-2*(Z-.5),Z=K(Z);else if(J===5){if(Q===j)Z=0;else{var te=Q-j,ne=-te/2+(G=R(B(0,G+.5-j),Q-j)),ie=te/2;Z=Math.sqrt(1-ne*ne/(ie*ie))}Z=K(Z)}else J===6?(Q===j?Z=0:(G=R(B(0,G+.5-j),Q-j),Z=(1+Math.cos(Math.PI+2*Math.PI*G/(Q-j)))/2),Z=K(Z)):(G>=F(j)&&(Z=B(0,R(G-j<0?R(Q,1)-(j-G):Q-G,1))),Z=K(Z));if(this.sm.v!==100){var re=.01*this.sm.v;re===0&&(re=1e-8);var oe=.5-.5*re;Z1&&(Z=1)}return Z*this.a.v},getValue:function(G){this.iterateDynamicProperties(),this._mdf=G||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,G&&this.data.r===2&&(this.e.v=this._currentTextLength);var U=this.data.r===2?1:100/this.data.totalChars,W=this.o.v/U,q=this.s.v/U+W,Y=this.e.v/U+W;if(q>Y){var K=q;q=Y,Y=K}this.finalS=q,this.finalE=Y}},extendPrototype([DynamicPropertyContainer],D),{getTextSelectorProp:function(G,U,W){return new D(G,U)}}}();function TextAnimatorDataProperty(B,R,F){var D={propType:!1},G=PropertyFactory.getProp,U=R.a;this.a={r:U.r?G(B,U.r,0,degToRads,F):D,rx:U.rx?G(B,U.rx,0,degToRads,F):D,ry:U.ry?G(B,U.ry,0,degToRads,F):D,sk:U.sk?G(B,U.sk,0,degToRads,F):D,sa:U.sa?G(B,U.sa,0,degToRads,F):D,s:U.s?G(B,U.s,1,.01,F):D,a:U.a?G(B,U.a,1,0,F):D,o:U.o?G(B,U.o,0,.01,F):D,p:U.p?G(B,U.p,1,0,F):D,sw:U.sw?G(B,U.sw,0,0,F):D,sc:U.sc?G(B,U.sc,1,0,F):D,fc:U.fc?G(B,U.fc,1,0,F):D,fh:U.fh?G(B,U.fh,0,0,F):D,fs:U.fs?G(B,U.fs,0,.01,F):D,fb:U.fb?G(B,U.fb,0,.01,F):D,t:U.t?G(B,U.t,0,0,F):D},this.s=TextSelectorProp.getTextSelectorProp(B,R.s,F),this.s.t=R.s.t}function TextAnimatorProperty(B,R,F){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=B,this._renderType=R,this._elem=F,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(F)}function ITextElement(){}TextAnimatorProperty.prototype.searchProperties=function(){var B,R,F=this._textData.a.length,D=PropertyFactory.getProp;for(B=0;B=q+ct||!te?(oe=(q+ct-K)/Y.partialLength,Se=J.point[0]+(Y.point[0]-J.point[0])*oe,Ne=J.point[1]+(Y.point[1]-J.point[1])*oe,me.translate(-he[0]*pe[G].an*.005,-he[1]*Ie*.01),Z=!1):te&&(K+=Y.partialLength,(j+=1)>=te.length&&(j=0,ne[Q+=1]?te=ne[Q].points:fe.v.c?(j=0,te=ne[Q=0].points):(K-=Y.partialLength,te=null)),te&&(J=Y,ie=(Y=te[j]).partialLength));Te=pe[G].an/2-pe[G].add,me.translate(-Te,0,0)}else Te=pe[G].an/2-pe[G].add,me.translate(-Te,0,0),me.translate(-he[0]*pe[G].an*.005,-he[1]*Ie*.01,0);for(_e=0;_eB?this.textSpans[B].span:createNS(Y?"g":"text"),ie<=B){if(W.setAttribute("stroke-linecap","butt"),W.setAttribute("stroke-linejoin","round"),W.setAttribute("stroke-miterlimit","4"),this.textSpans[B].span=W,Y){var re=createNS("g");W.appendChild(re),this.textSpans[B].childSpan=re}this.textSpans[B].span=W,this.layerElement.appendChild(W)}W.style.display="inherit"}if(K.reset(),K.scale(F.finalSize/100,F.finalSize/100),Z&&(q[B].n&&(j=-te,Q+=F.yOffset,Q+=J?1:0,J=!1),this.applyTextPropertiesToMatrix(F,K,q[B].line,j,Q),j+=q[B].l||0,j+=te),Y){var oe;if((ne=this.globalData.fontManager.getCharData(F.finalText[B],D.fStyle,this.globalData.fontManager.getFontByName(F.f).fFamily)).t===1)oe=new SVGCompElement(ne.data,this.globalData,this);else{var le=emptyShapeData;ne.data&&ne.data.shapes&&(le=ne.data),oe=new SVGShapeElement(le,this.globalData,this)}this.textSpans[B].glyph=oe,oe._debug=!0,oe.prepareFrame(0),oe.renderFrame(),this.textSpans[B].childSpan.appendChild(oe.layerElement),this.textSpans[B].childSpan.setAttribute("transform","scale("+F.finalSize/100+","+F.finalSize/100+")")}else Z&&W.setAttribute("transform","translate("+K.props[12]+","+K.props[13]+")"),W.textContent=q[B].val,W.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}Z&&W&&W.setAttribute("d","")}else{var fe=this.textContainer,he="start";switch(F.j){case 1:he="end";break;case 2:he="middle";break;default:he="start"}fe.setAttribute("text-anchor",he),fe.setAttribute("letter-spacing",te);var ge=this.buildTextContents(F.finalText);for(R=ge.length,Q=F.ps?F.ps[1]+F.ascent:0,B=0;B=0;R-=1)(this.completeLayers||this.elements[R])&&this.elements[R].prepareFrame(B-this.layers[R].st);if(this.globalData._mdf)for(R=0;R=0;F-=1)(this.completeLayers||this.elements[F])&&(this.elements[F].prepareFrame(this.renderedFrame-this.layers[F].st),this.elements[F]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var B,R=this.layers.length;for(B=0;B=U;)re/=2,oe/=2,le>>>=1;return(re+le)/oe};return ie.int32=function(){return 0|ne.g(4)},ie.quick=function(){return ne.g(4)/4294967296},ie.double=ie,Y(K(ne.S),B),(j.pass||Q||function(re,oe,le,fe){return fe&&(fe.S&&q(fe,ne),re.state=function(){return q(ne,{})}),le?(R.random=re,oe):re})(ie,te,"global"in j?j.global:this==R,j.state)},Y(R.random(),B)}function initialize$2(B){seedRandom([],B)}var propTypes={SHAPE:"shape"};function _typeof(B){return(_typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R})(B)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null;function $bm_isInstanceOfArray(B){return B.constructor===Array||B.constructor===Float32Array}function isNumerable(B,R){return B==="number"||B==="boolean"||B==="string"||R instanceof Number}function $bm_neg(B){var R=_typeof(B);if(R==="number"||R==="boolean"||B instanceof Number)return-B;if($bm_isInstanceOfArray(B)){var F,D=B.length,G=[];for(F=0;FF){var D=F;F=R,R=D}return Math.min(Math.max(B,R),F)}function radiansToDegrees(B){return B/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(B){return B*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(B,R){if(typeof B=="number"||B instanceof Number)return R=R||0,Math.abs(B-R);var F;R||(R=helperLengthArray);var D=Math.min(B.length,R.length),G=0;for(F=0;F.5?K/(2-W-q):K/(W+q),W){case D:R=(G-U)/K+(G1&&(F-=1),F<1/6?B+6*(R-B)*F:F<.5?R:F<2/3?B+(R-B)*(2/3-F)*6:B}function hslToRgb(B){var R,F,D,G=B[0],U=B[1],W=B[2];if(U===0)R=W,D=W,F=W;else{var q=W<.5?W*(1+U):W+U-W*U,Y=2*W-q;R=hue2rgb(Y,q,G+1/3),F=hue2rgb(Y,q,G),D=hue2rgb(Y,q,G-1/3)}return[R,F,D,B[3]]}function linear(B,R,F,D,G){if(D!==void 0&&G!==void 0||(D=R,G=F,R=0,F=1),F=F)return G;var W,q=F===R?0:(B-R)/(F-R);if(!D.length)return D+(G-D)*q;var Y=D.length,K=createTypedArray("float32",Y);for(W=0;W1){for(D=0;D1?R=1:R<0&&(R=0);var W=B(R);if($bm_isInstanceOfArray(G)){var q,Y=G.length,K=createTypedArray("float32",Y);for(q=0;qdata.k[R].t&&Bdata.k[R+1].t-B?(F=R+2,D=data.k[R+1].t):(F=R+1,D=data.k[R].t);break}}F===-1&&(F=R+1,D=data.k[R].t)}else F=0,D=0;var U={};return U.index=F,U.time=D/elem.comp.globalData.frameRate,U}function key(B){var R,F,D;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+B);B-=1,R={time:data.k[B].t/elem.comp.globalData.frameRate,value:[]};var G=Object.prototype.hasOwnProperty.call(data.k[B],"s")?data.k[B].s:data.k[B-1].e;for(D=G.length,F=0;Ffe.length-1)&&(Q=fe.length-1),te=he-(ne=fe[fe.length-1-Q].t)),j==="pingpong"){if(Math.floor((le-ne)/te)%2!=0)return this.getValueAtTime((te-(le-ne)%te+ne)/this.comp.globalData.frameRate,0)}else{if(j==="offset"){var ge=this.getValueAtTime(ne/this.comp.globalData.frameRate,0),ce=this.getValueAtTime(he/this.comp.globalData.frameRate,0),me=this.getValueAtTime(((le-ne)%te+ne)/this.comp.globalData.frameRate,0),ye=Math.floor((le-ne)/te);if(this.pv.length){for(re=(oe=new Array(ge.length)).length,ie=0;ie=he)return this.pv;if(J?ne=he+(te=Q?Math.abs(this.elem.comp.globalData.frameRate*Q):Math.max(0,this.elem.data.op-he)):((!Q||Q>fe.length-1)&&(Q=fe.length-1),te=(ne=fe[Q].t)-he),j==="pingpong"){if(Math.floor((he-le)/te)%2==0)return this.getValueAtTime(((he-le)%te+he)/this.comp.globalData.frameRate,0)}else{if(j==="offset"){var ge=this.getValueAtTime(he/this.comp.globalData.frameRate,0),ce=this.getValueAtTime(ne/this.comp.globalData.frameRate,0),me=this.getValueAtTime((te-(he-le)%te+he)/this.comp.globalData.frameRate,0),ye=Math.floor((he-le)/te)+1;if(this.pv.length){for(re=(oe=new Array(ge.length)).length,ie=0;ie1?(ne+j-ie)/(Q-1):1,oe=0,le=0;for(J=this.pv.length?createTypedArray("float32",this.pv.length):0;oere){var he=oe,ge=J.c&&oe===le-1?0:oe+1,ce=(re-fe)/ie[oe].addedLength;te=bez.getPointInSegment(J.v[he],J.v[ge],J.o[he],J.i[ge],ce,ie[oe]);break}fe+=ie[oe].addedLength,oe+=1}return te||(te=J.c?[J.v[0][0],J.v[0][1]]:[J.v[J._length-1][0],J.v[J._length-1][1]]),te},vectorOnPath:function(j,Q,J){j==1?j=this.v.c:j==0&&(j=.999);var te=this.pointOnPath(j,Q),ne=this.pointOnPath(j+.001,Q),ie=ne[0]-te[0],re=ne[1]-te[1],oe=Math.sqrt(Math.pow(ie,2)+Math.pow(re,2));return oe===0?[0,0]:J==="tangent"?[ie/oe,re/oe]:[-re/oe,ie/oe]},tangentOnPath:function(j,Q){return this.vectorOnPath(j,Q,"tangent")},normalOnPath:function(j,Q){return this.vectorOnPath(j,Q,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([K],q),extendPrototype([K],Y),Y.prototype.getValueAtTime=function(j){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),j*=this.elem.globalData.frameRate,(j-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(F){B.exports=F()})(function(){return function F(D,G,U){function W(K,Z){if(!G[K]){if(!D[K]){var j=typeof commonjsRequire=="function"&&commonjsRequire;if(!Z&&j)return j(K,!0);if(q)return q(K,!0);var Q=new Error("Cannot find module '"+K+"'");throw Q.code="MODULE_NOT_FOUND",Q}var J=G[K]={exports:{}};D[K][0].call(J.exports,function(te){var ne=D[K][1][te];return W(ne||te)},J,J.exports,F,D,G,U)}return G[K].exports}for(var q=typeof commonjsRequire=="function"&&commonjsRequire,Y=0;Y>2,J=(3&K)<<4|Z>>4,te=le>1?(15&Z)<<2|j>>6:64,ne=le>2?63&j:64,ie.push(q.charAt(Q)+q.charAt(J)+q.charAt(te)+q.charAt(ne));return ie.join("")},G.decode=function(Y){var K,Z,j,Q,J,te,ne=0,ie=0;if(Y.substr(0,5)==="data:")throw new Error("Invalid base64 input, it looks like a data url.");var re,oe=3*(Y=Y.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(Y.charAt(Y.length-1)===q.charAt(64)&&oe--,Y.charAt(Y.length-2)===q.charAt(64)&&oe--,oe%1!=0)throw new Error("Invalid base64 input, bad content length.");for(re=W.uint8array?new Uint8Array(0|oe):new Array(0|oe);ne>4,Z=(15&Q)<<4|(J=q.indexOf(Y.charAt(ne++)))>>2,j=(3&J)<<6|(te=q.indexOf(Y.charAt(ne++))),re[ie++]=K,J!==64&&(re[ie++]=Z),te!==64&&(re[ie++]=j);return re}},{"./support":30,"./utils":32}],2:[function(F,D,G){var U=F("./external"),W=F("./stream/DataWorker"),q=F("./stream/Crc32Probe"),Y=F("./stream/DataLengthProbe");function K(Z,j,Q,J,te){this.compressedSize=Z,this.uncompressedSize=j,this.crc32=Q,this.compression=J,this.compressedContent=te}K.prototype={getContentWorker:function(){var Z=new W(U.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Y("data_length")),j=this;return Z.on("end",function(){if(this.streamInfo.data_length!==j.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),Z},getCompressedWorker:function(){return new W(U.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},K.createWorkerFrom=function(Z,j,Q){return Z.pipe(new q).pipe(new Y("uncompressedSize")).pipe(j.compressWorker(Q)).pipe(new Y("compressedSize")).withStreamInfo("compression",j)},D.exports=K},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(F,D,G){var U=F("./stream/GenericWorker");G.STORE={magic:"\0\0",compressWorker:function(W){return new U("STORE compression")},uncompressWorker:function(){return new U("STORE decompression")}},G.DEFLATE=F("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(F,D,G){var U=F("./utils"),W=function(){for(var q,Y=[],K=0;K<256;K++){q=K;for(var Z=0;Z<8;Z++)q=1&q?3988292384^q>>>1:q>>>1;Y[K]=q}return Y}();D.exports=function(q,Y){return q!==void 0&&q.length?U.getTypeOf(q)!=="string"?function(K,Z,j,Q){var J=W,te=Q+j;K^=-1;for(var ne=Q;ne>>8^J[255&(K^Z[ne])];return-1^K}(0|Y,q,q.length,0):function(K,Z,j,Q){var J=W,te=Q+j;K^=-1;for(var ne=Q;ne>>8^J[255&(K^Z.charCodeAt(ne))];return-1^K}(0|Y,q,q.length,0):0}},{"./utils":32}],5:[function(F,D,G){G.base64=!1,G.binary=!1,G.dir=!1,G.createFolders=!0,G.date=null,G.compression=null,G.compressionOptions=null,G.comment=null,G.unixPermissions=null,G.dosPermissions=null},{}],6:[function(F,D,G){var U=null;U=typeof Promise!="undefined"?Promise:F("lie"),D.exports={Promise:U}},{lie:37}],7:[function(F,D,G){var U=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",W=F("pako"),q=F("./utils"),Y=F("./stream/GenericWorker"),K=U?"uint8array":"array";function Z(j,Q){Y.call(this,"FlateWorker/"+j),this._pako=null,this._pakoAction=j,this._pakoOptions=Q,this.meta={}}G.magic="\b\0",q.inherits(Z,Y),Z.prototype.processChunk=function(j){this.meta=j.meta,this._pako===null&&this._createPako(),this._pako.push(q.transformTo(K,j.data),!1)},Z.prototype.flush=function(){Y.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},Z.prototype.cleanUp=function(){Y.prototype.cleanUp.call(this),this._pako=null},Z.prototype._createPako=function(){this._pako=new W[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var j=this;this._pako.onData=function(Q){j.push({data:Q,meta:j.meta})}},G.compressWorker=function(j){return new Z("Deflate",j)},G.uncompressWorker=function(){return new Z("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(F,D,G){var U=F("../utils"),W=F("../stream/GenericWorker"),q=F("../utf8"),Y=F("../crc32"),K=F("../signature"),Z=function(te,ne){var ie,re="";for(ie=0;ie>>=8;return re},j=function(te,ne,ie,re,oe,le){var fe,he,ge=te.file,ce=te.compression,me=le!==q.utf8encode,ye=U.transformTo("string",le(ge.name)),ve=U.transformTo("string",q.utf8encode(ge.name)),pe=ge.comment,be=U.transformTo("string",le(pe)),xe=U.transformTo("string",q.utf8encode(pe)),ue=ve.length!==ge.name.length,_e=xe.length!==pe.length,Be="",Ae="",Pe="",Ie=ge.dir,Ce=ge.date,Te={crc32:0,compressedSize:0,uncompressedSize:0};ne&&!ie||(Te.crc32=te.crc32,Te.compressedSize=te.compressedSize,Te.uncompressedSize=te.uncompressedSize);var Se=0;ne&&(Se|=8),me||!ue&&!_e||(Se|=2048);var Ne,Ge,ke,$e=0,We=0;Ie&&($e|=16),oe==="UNIX"?(We=798,$e|=(Ne=ge.unixPermissions,Ge=Ie,ke=Ne,Ne||(ke=Ge?16893:33204),(65535&ke)<<16)):(We=20,$e|=63&(ge.dosPermissions||0)),fe=Ce.getUTCHours(),fe<<=6,fe|=Ce.getUTCMinutes(),fe<<=5,fe|=Ce.getUTCSeconds()/2,he=Ce.getUTCFullYear()-1980,he<<=4,he|=Ce.getUTCMonth()+1,he<<=5,he|=Ce.getUTCDate(),ue&&(Ae=Z(1,1)+Z(Y(ye),4)+ve,Be+="up"+Z(Ae.length,2)+Ae),_e&&(Pe=Z(1,1)+Z(Y(be),4)+xe,Be+="uc"+Z(Pe.length,2)+Pe);var Ve="";return Ve+=` \0`,Ve+=Z(Se,2),Ve+=ce.magic,Ve+=Z(fe,2),Ve+=Z(he,2),Ve+=Z(Te.crc32,4),Ve+=Z(Te.compressedSize,4),Ve+=Z(Te.uncompressedSize,4),Ve+=Z(ye.length,2),Ve+=Z(Be.length,2),{fileRecord:K.LOCAL_FILE_HEADER+Ve+ye+Be,dirRecord:K.CENTRAL_FILE_HEADER+Z(We,2)+Ve+Z(be.length,2)+"\0\0\0\0"+Z($e,4)+Z(re,4)+ye+Be+be}},Q=function(te){return K.DATA_DESCRIPTOR+Z(te.crc32,4)+Z(te.compressedSize,4)+Z(te.uncompressedSize,4)};function J(te,ne,ie,re){W.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=ne,this.zipPlatform=ie,this.encodeFileName=re,this.streamFiles=te,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}U.inherits(J,W),J.prototype.push=function(te){var ne=te.meta.percent||0,ie=this.entriesCount,re=this._sources.length;this.accumulate?this.contentBuffer.push(te):(this.bytesWritten+=te.data.length,W.prototype.push.call(this,{data:te.data,meta:{currentFile:this.currentFile,percent:ie?(ne+100*(ie-re-1))/ie:100}}))},J.prototype.openedSource=function(te){this.currentSourceOffset=this.bytesWritten,this.currentFile=te.file.name;var ne=this.streamFiles&&!te.file.dir;if(ne){var ie=j(te,ne,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:ie.fileRecord,meta:{percent:0}})}else this.accumulate=!0},J.prototype.closedSource=function(te){this.accumulate=!1;var ne=this.streamFiles&&!te.file.dir,ie=j(te,ne,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(ie.dirRecord),ne)this.push({data:Q(te),meta:{percent:100}});else for(this.push({data:ie.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},J.prototype.flush=function(){for(var te=this.bytesWritten,ne=0;ne0?he.substring(0,ge):""},re=function(he){return he.slice(-1)!=="/"&&(he+="/"),he},oe=function(he,ge){return ge=ge!==void 0?ge:K.createFolders,he=re(he),this.files[he]||ne.call(this,he,null,{dir:!0,createFolders:ge}),this.files[he]};function le(he){return Object.prototype.toString.call(he)==="[object RegExp]"}var fe={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(he){var ge,ce,me;for(ge in this.files)me=this.files[ge],(ce=ge.slice(this.root.length,ge.length))&&ge.slice(0,this.root.length)===this.root&&he(ce,me)},filter:function(he){var ge=[];return this.forEach(function(ce,me){he(ce,me)&&ge.push(me)}),ge},file:function(he,ge,ce){if(arguments.length===1){if(le(he)){var me=he;return this.filter(function(ve,pe){return!pe.dir&&me.test(ve)})}var ye=this.files[this.root+he];return ye&&!ye.dir?ye:null}return he=this.root+he,ne.call(this,he,ge,ce),this},folder:function(he){if(!he)return this;if(le(he))return this.filter(function(ye,ve){return ve.dir&&he.test(ye)});var ge=this.root+he,ce=oe.call(this,ge),me=this.clone();return me.root=ce.name,me},remove:function(he){he=this.root+he;var ge=this.files[he];if(ge||(he.slice(-1)!=="/"&&(he+="/"),ge=this.files[he]),ge&&!ge.dir)delete this.files[he];else for(var ce=this.filter(function(ye,ve){return ve.name.slice(0,he.length)===he}),me=0;me=0;--Q)if(this.data[Q]===Y&&this.data[Q+1]===K&&this.data[Q+2]===Z&&this.data[Q+3]===j)return Q-this.zero;return-1},W.prototype.readAndCheckSignature=function(q){var Y=q.charCodeAt(0),K=q.charCodeAt(1),Z=q.charCodeAt(2),j=q.charCodeAt(3),Q=this.readData(4);return Y===Q[0]&&K===Q[1]&&Z===Q[2]&&j===Q[3]},W.prototype.readData=function(q){if(this.checkOffset(q),q===0)return[];var Y=this.data.slice(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./DataReader":18}],18:[function(F,D,G){var U=F("../utils");function W(q){this.data=q,this.length=q.length,this.index=0,this.zero=0}W.prototype={checkOffset:function(q){this.checkIndex(this.index+q)},checkIndex:function(q){if(this.length=this.index;Y--)K=(K<<8)+this.byteAt(Y);return this.index+=q,K},readString:function(q){return U.transformTo("string",this.readData(q))},readData:function(q){},lastIndexOfSignature:function(q){},readAndCheckSignature:function(q){},readDate:function(){var q=this.readInt(4);return new Date(Date.UTC(1980+(q>>25&127),(q>>21&15)-1,q>>16&31,q>>11&31,q>>5&63,(31&q)<<1))}},D.exports=W},{"../utils":32}],19:[function(F,D,G){var U=F("./Uint8ArrayReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.readData=function(q){this.checkOffset(q);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(F,D,G){var U=F("./DataReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.byteAt=function(q){return this.data.charCodeAt(this.zero+q)},W.prototype.lastIndexOfSignature=function(q){return this.data.lastIndexOf(q)-this.zero},W.prototype.readAndCheckSignature=function(q){return q===this.readData(4)},W.prototype.readData=function(q){this.checkOffset(q);var Y=this.data.slice(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./DataReader":18}],21:[function(F,D,G){var U=F("./ArrayReader");function W(q){U.call(this,q)}F("../utils").inherits(W,U),W.prototype.readData=function(q){if(this.checkOffset(q),q===0)return new Uint8Array(0);var Y=this.data.subarray(this.zero+this.index,this.zero+this.index+q);return this.index+=q,Y},D.exports=W},{"../utils":32,"./ArrayReader":17}],22:[function(F,D,G){var U=F("../utils"),W=F("../support"),q=F("./ArrayReader"),Y=F("./StringReader"),K=F("./NodeBufferReader"),Z=F("./Uint8ArrayReader");D.exports=function(j){var Q=U.getTypeOf(j);return U.checkSupport(Q),Q!=="string"||W.uint8array?Q==="nodebuffer"?new K(j):W.uint8array?new Z(U.transformTo("uint8array",j)):new q(U.transformTo("array",j)):new Y(j)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(F,D,G){G.LOCAL_FILE_HEADER="PK",G.CENTRAL_FILE_HEADER="PK",G.CENTRAL_DIRECTORY_END="PK",G.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",G.ZIP64_CENTRAL_DIRECTORY_END="PK",G.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(F,D,G){var U=F("./GenericWorker"),W=F("../utils");function q(Y){U.call(this,"ConvertWorker to "+Y),this.destType=Y}W.inherits(q,U),q.prototype.processChunk=function(Y){this.push({data:W.transformTo(this.destType,Y.data),meta:Y.meta})},D.exports=q},{"../utils":32,"./GenericWorker":28}],25:[function(F,D,G){var U=F("./GenericWorker"),W=F("../crc32");function q(){U.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}F("../utils").inherits(q,U),q.prototype.processChunk=function(Y){this.streamInfo.crc32=W(Y.data,this.streamInfo.crc32||0),this.push(Y)},D.exports=q},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(F,D,G){var U=F("../utils"),W=F("./GenericWorker");function q(Y){W.call(this,"DataLengthProbe for "+Y),this.propName=Y,this.withStreamInfo(Y,0)}U.inherits(q,W),q.prototype.processChunk=function(Y){if(Y){var K=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=K+Y.data.length}W.prototype.processChunk.call(this,Y)},D.exports=q},{"../utils":32,"./GenericWorker":28}],27:[function(F,D,G){var U=F("../utils"),W=F("./GenericWorker");function q(Y){W.call(this,"DataWorker");var K=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Y.then(function(Z){K.dataIsReady=!0,K.data=Z,K.max=Z&&Z.length||0,K.type=U.getTypeOf(Z),K.isPaused||K._tickAndRepeat()},function(Z){K.error(Z)})}U.inherits(q,W),q.prototype.cleanUp=function(){W.prototype.cleanUp.call(this),this.data=null},q.prototype.resume=function(){return!!W.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,U.delay(this._tickAndRepeat,[],this)),!0)},q.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(U.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},q.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Y=null,K=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":Y=this.data.substring(this.index,K);break;case"uint8array":Y=this.data.subarray(this.index,K);break;case"array":case"nodebuffer":Y=this.data.slice(this.index,K)}return this.index=K,this.push({data:Y,meta:{percent:this.max?this.index/this.max*100:0}})},D.exports=q},{"../utils":32,"./GenericWorker":28}],28:[function(F,D,G){function U(W){this.name=W||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}U.prototype={push:function(W){this.emit("data",W)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(W){this.emit("error",W)}return!0},error:function(W){return!this.isFinished&&(this.isPaused?this.generatedError=W:(this.isFinished=!0,this.emit("error",W),this.previous&&this.previous.error(W),this.cleanUp()),!0)},on:function(W,q){return this._listeners[W].push(q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(W,q){if(this._listeners[W])for(var Y=0;Y "+W:W}},D.exports=U},{}],29:[function(F,D,G){var U=F("../utils"),W=F("./ConvertWorker"),q=F("./GenericWorker"),Y=F("../base64"),K=F("../support"),Z=F("../external"),j=null;if(K.nodestream)try{j=F("../nodejs/NodejsStreamOutputAdapter")}catch{}function Q(te,ne){return new Z.Promise(function(ie,re){var oe=[],le=te._internalType,fe=te._outputType,he=te._mimeType;te.on("data",function(ge,ce){oe.push(ge),ne&&ne(ce)}).on("error",function(ge){oe=[],re(ge)}).on("end",function(){try{var ge=function(ce,me,ye){switch(ce){case"blob":return U.newBlob(U.transformTo("arraybuffer",me),ye);case"base64":return Y.encode(me);default:return U.transformTo(ce,me)}}(fe,function(ce,me){var ye,ve=0,pe=null,be=0;for(ye=0;ye=252?6:Z>=248?5:Z>=240?4:Z>=224?3:Z>=192?2:1;K[254]=K[254]=1;function j(){Y.call(this,"utf-8 decode"),this.leftOver=null}function Q(){Y.call(this,"utf-8 encode")}G.utf8encode=function(J){return W.nodebuffer?q.newBufferFrom(J,"utf-8"):function(te){var ne,ie,re,oe,le,fe=te.length,he=0;for(oe=0;oe>>6,ne[le++]=128|63&ie):ie<65536?(ne[le++]=224|ie>>>12,ne[le++]=128|ie>>>6&63,ne[le++]=128|63&ie):(ne[le++]=240|ie>>>18,ne[le++]=128|ie>>>12&63,ne[le++]=128|ie>>>6&63,ne[le++]=128|63&ie);return ne}(J)},G.utf8decode=function(J){return W.nodebuffer?U.transformTo("nodebuffer",J).toString("utf-8"):function(te){var ne,ie,re,oe,le=te.length,fe=new Array(2*le);for(ie=0,ne=0;ne4)fe[ie++]=65533,ne+=oe-1;else{for(re&=oe===2?31:oe===3?15:7;oe>1&&ne1?fe[ie++]=65533:re<65536?fe[ie++]=re:(re-=65536,fe[ie++]=55296|re>>10&1023,fe[ie++]=56320|1023&re)}return fe.length!==ie&&(fe.subarray?fe=fe.subarray(0,ie):fe.length=ie),U.applyFromCharCode(fe)}(J=U.transformTo(W.uint8array?"uint8array":"array",J))},U.inherits(j,Y),j.prototype.processChunk=function(J){var te=U.transformTo(W.uint8array?"uint8array":"array",J.data);if(this.leftOver&&this.leftOver.length){if(W.uint8array){var ne=te;(te=new Uint8Array(ne.length+this.leftOver.length)).set(this.leftOver,0),te.set(ne,this.leftOver.length)}else te=this.leftOver.concat(te);this.leftOver=null}var ie=function(oe,le){var fe;for((le=le||oe.length)>oe.length&&(le=oe.length),fe=le-1;fe>=0&&(192&oe[fe])==128;)fe--;return fe<0||fe===0?le:fe+K[oe[fe]]>le?fe:le}(te),re=te;ie!==te.length&&(W.uint8array?(re=te.subarray(0,ie),this.leftOver=te.subarray(ie,te.length)):(re=te.slice(0,ie),this.leftOver=te.slice(ie,te.length))),this.push({data:G.utf8decode(re),meta:J.meta})},j.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:G.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},G.Utf8DecodeWorker=j,U.inherits(Q,Y),Q.prototype.processChunk=function(J){this.push({data:G.utf8encode(J.data),meta:J.meta})},G.Utf8EncodeWorker=Q},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(F,D,G){var U=F("./support"),W=F("./base64"),q=F("./nodejsUtils"),Y=F("./external");function K(ne){return ne}function Z(ne,ie){for(var re=0;re1;)try{return j.stringifyByChunk(ne,re,ie)}catch{ie=Math.floor(ie/2)}return j.stringifyByChar(ne)}function J(ne,ie){for(var re=0;re1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var j,Q;for(j=0;j0)this.isSignature(Q,q.CENTRAL_FILE_HEADER)||(this.reader.zero=te);else if(te<0)throw new Error("Corrupted zip: missing "+Math.abs(te)+" bytes.")},prepareReader:function(j){this.reader=U(j)},load:function(j){this.prepareReader(j),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},D.exports=Z},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(F,D,G){var U=F("./reader/readerFor"),W=F("./utils"),q=F("./compressedObject"),Y=F("./crc32"),K=F("./utf8"),Z=F("./compressions"),j=F("./support");function Q(J,te){this.options=J,this.loadOptions=te}Q.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(J){var te,ne;if(J.skip(22),this.fileNameLength=J.readInt(2),ne=J.readInt(2),this.fileName=J.readData(this.fileNameLength),J.skip(ne),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((te=function(ie){for(var re in Z)if(Z.hasOwnProperty(re)&&Z[re].magic===ie)return Z[re];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+W.pretty(this.compressionMethod)+" unknown (inner file : "+W.transformTo("string",this.fileName)+")");this.decompressed=new q(this.compressedSize,this.uncompressedSize,this.crc32,te,J.readData(this.compressedSize))},readCentralPart:function(J){this.versionMadeBy=J.readInt(2),J.skip(2),this.bitFlag=J.readInt(2),this.compressionMethod=J.readString(2),this.date=J.readDate(),this.crc32=J.readInt(4),this.compressedSize=J.readInt(4),this.uncompressedSize=J.readInt(4);var te=J.readInt(2);if(this.extraFieldsLength=J.readInt(2),this.fileCommentLength=J.readInt(2),this.diskNumberStart=J.readInt(2),this.internalFileAttributes=J.readInt(2),this.externalFileAttributes=J.readInt(4),this.localHeaderOffset=J.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");J.skip(te),this.readExtraFields(J),this.parseZIP64ExtraField(J),this.fileComment=J.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var J=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),J===0&&(this.dosPermissions=63&this.externalFileAttributes),J===3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(J){if(this.extraFields[1]){var te=U(this.extraFields[1].value);this.uncompressedSize===W.MAX_VALUE_32BITS&&(this.uncompressedSize=te.readInt(8)),this.compressedSize===W.MAX_VALUE_32BITS&&(this.compressedSize=te.readInt(8)),this.localHeaderOffset===W.MAX_VALUE_32BITS&&(this.localHeaderOffset=te.readInt(8)),this.diskNumberStart===W.MAX_VALUE_32BITS&&(this.diskNumberStart=te.readInt(4))}},readExtraFields:function(J){var te,ne,ie,re=J.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});J.index+40?te.windowBits=-te.windowBits:te.gzip&&te.windowBits>0&&te.windowBits<16&&(te.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new K,this.strm.avail_out=0;var ne=U.deflateInit2(this.strm,te.level,te.method,te.windowBits,te.memLevel,te.strategy);if(ne!==0)throw new Error(Y[ne]);if(te.header&&U.deflateSetHeader(this.strm,te.header),te.dictionary){var ie;if(ie=typeof te.dictionary=="string"?q.string2buf(te.dictionary):Z.call(te.dictionary)==="[object ArrayBuffer]"?new Uint8Array(te.dictionary):te.dictionary,(ne=U.deflateSetDictionary(this.strm,ie))!==0)throw new Error(Y[ne]);this._dict_set=!0}}function Q(J,te){var ne=new j(te);if(ne.push(J,!0),ne.err)throw ne.msg||Y[ne.err];return ne.result}j.prototype.push=function(J,te){var ne,ie,re=this.strm,oe=this.options.chunkSize;if(this.ended)return!1;ie=te===~~te?te:te===!0?4:0,typeof J=="string"?re.input=q.string2buf(J):Z.call(J)==="[object ArrayBuffer]"?re.input=new Uint8Array(J):re.input=J,re.next_in=0,re.avail_in=re.input.length;do{if(re.avail_out===0&&(re.output=new W.Buf8(oe),re.next_out=0,re.avail_out=oe),(ne=U.deflate(re,ie))!==1&&ne!==0)return this.onEnd(ne),this.ended=!0,!1;re.avail_out!==0&&(re.avail_in!==0||ie!==4&&ie!==2)||(this.options.to==="string"?this.onData(q.buf2binstring(W.shrinkBuf(re.output,re.next_out))):this.onData(W.shrinkBuf(re.output,re.next_out)))}while((re.avail_in>0||re.avail_out===0)&&ne!==1);return ie===4?(ne=U.deflateEnd(this.strm),this.onEnd(ne),this.ended=!0,ne===0):ie!==2||(this.onEnd(0),re.avail_out=0,!0)},j.prototype.onData=function(J){this.chunks.push(J)},j.prototype.onEnd=function(J){J===0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=W.flattenChunks(this.chunks)),this.chunks=[],this.err=J,this.msg=this.strm.msg},G.Deflate=j,G.deflate=Q,G.deflateRaw=function(J,te){return(te=te||{}).raw=!0,Q(J,te)},G.gzip=function(J,te){return(te=te||{}).gzip=!0,Q(J,te)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(F,D,G){var U=F("./zlib/inflate"),W=F("./utils/common"),q=F("./utils/strings"),Y=F("./zlib/constants"),K=F("./zlib/messages"),Z=F("./zlib/zstream"),j=F("./zlib/gzheader"),Q=Object.prototype.toString;function J(ne){if(!(this instanceof J))return new J(ne);this.options=W.assign({chunkSize:16384,windowBits:0,to:""},ne||{});var ie=this.options;ie.raw&&ie.windowBits>=0&&ie.windowBits<16&&(ie.windowBits=-ie.windowBits,ie.windowBits===0&&(ie.windowBits=-15)),!(ie.windowBits>=0&&ie.windowBits<16)||ne&&ne.windowBits||(ie.windowBits+=32),ie.windowBits>15&&ie.windowBits<48&&(15&ie.windowBits)==0&&(ie.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Z,this.strm.avail_out=0;var re=U.inflateInit2(this.strm,ie.windowBits);if(re!==Y.Z_OK)throw new Error(K[re]);this.header=new j,U.inflateGetHeader(this.strm,this.header)}function te(ne,ie){var re=new J(ie);if(re.push(ne,!0),re.err)throw re.msg||K[re.err];return re.result}J.prototype.push=function(ne,ie){var re,oe,le,fe,he,ge,ce=this.strm,me=this.options.chunkSize,ye=this.options.dictionary,ve=!1;if(this.ended)return!1;oe=ie===~~ie?ie:ie===!0?Y.Z_FINISH:Y.Z_NO_FLUSH,typeof ne=="string"?ce.input=q.binstring2buf(ne):Q.call(ne)==="[object ArrayBuffer]"?ce.input=new Uint8Array(ne):ce.input=ne,ce.next_in=0,ce.avail_in=ce.input.length;do{if(ce.avail_out===0&&(ce.output=new W.Buf8(me),ce.next_out=0,ce.avail_out=me),(re=U.inflate(ce,Y.Z_NO_FLUSH))===Y.Z_NEED_DICT&&ye&&(ge=typeof ye=="string"?q.string2buf(ye):Q.call(ye)==="[object ArrayBuffer]"?new Uint8Array(ye):ye,re=U.inflateSetDictionary(this.strm,ge)),re===Y.Z_BUF_ERROR&&ve===!0&&(re=Y.Z_OK,ve=!1),re!==Y.Z_STREAM_END&&re!==Y.Z_OK)return this.onEnd(re),this.ended=!0,!1;ce.next_out&&(ce.avail_out!==0&&re!==Y.Z_STREAM_END&&(ce.avail_in!==0||oe!==Y.Z_FINISH&&oe!==Y.Z_SYNC_FLUSH)||(this.options.to==="string"?(le=q.utf8border(ce.output,ce.next_out),fe=ce.next_out-le,he=q.buf2string(ce.output,le),ce.next_out=fe,ce.avail_out=me-fe,fe&&W.arraySet(ce.output,ce.output,le,fe,0),this.onData(he)):this.onData(W.shrinkBuf(ce.output,ce.next_out)))),ce.avail_in===0&&ce.avail_out===0&&(ve=!0)}while((ce.avail_in>0||ce.avail_out===0)&&re!==Y.Z_STREAM_END);return re===Y.Z_STREAM_END&&(oe=Y.Z_FINISH),oe===Y.Z_FINISH?(re=U.inflateEnd(this.strm),this.onEnd(re),this.ended=!0,re===Y.Z_OK):oe!==Y.Z_SYNC_FLUSH||(this.onEnd(Y.Z_OK),ce.avail_out=0,!0)},J.prototype.onData=function(ne){this.chunks.push(ne)},J.prototype.onEnd=function(ne){ne===Y.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=W.flattenChunks(this.chunks)),this.chunks=[],this.err=ne,this.msg=this.strm.msg},G.Inflate=J,G.inflate=te,G.inflateRaw=function(ne,ie){return(ie=ie||{}).raw=!0,te(ne,ie)},G.ungzip=te},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(F,D,G){var U=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";G.assign=function(Y){for(var K=Array.prototype.slice.call(arguments,1);K.length;){var Z=K.shift();if(Z){if(typeof Z!="object")throw new TypeError(Z+"must be non-object");for(var j in Z)Z.hasOwnProperty(j)&&(Y[j]=Z[j])}}return Y},G.shrinkBuf=function(Y,K){return Y.length===K?Y:Y.subarray?Y.subarray(0,K):(Y.length=K,Y)};var W={arraySet:function(Y,K,Z,j,Q){if(K.subarray&&Y.subarray)Y.set(K.subarray(Z,Z+j),Q);else for(var J=0;J=252?6:K>=248?5:K>=240?4:K>=224?3:K>=192?2:1;function Z(j,Q){if(Q<65537&&(j.subarray&&q||!j.subarray&&W))return String.fromCharCode.apply(null,U.shrinkBuf(j,Q));for(var J="",te=0;te>>6,Q[ie++]=128|63&J):J<65536?(Q[ie++]=224|J>>>12,Q[ie++]=128|J>>>6&63,Q[ie++]=128|63&J):(Q[ie++]=240|J>>>18,Q[ie++]=128|J>>>12&63,Q[ie++]=128|J>>>6&63,Q[ie++]=128|63&J);return Q},G.buf2binstring=function(j){return Z(j,j.length)},G.binstring2buf=function(j){for(var Q=new U.Buf8(j.length),J=0,te=Q.length;J4)oe[te++]=65533,J+=ie-1;else{for(ne&=ie===2?31:ie===3?15:7;ie>1&&J1?oe[te++]=65533:ne<65536?oe[te++]=ne:(ne-=65536,oe[te++]=55296|ne>>10&1023,oe[te++]=56320|1023&ne)}return Z(oe,te)},G.utf8border=function(j,Q){var J;for((Q=Q||j.length)>j.length&&(Q=j.length),J=Q-1;J>=0&&(192&j[J])==128;)J--;return J<0||J===0?Q:J+Y[j[J]]>Q?J:Q}},{"./common":41}],43:[function(F,D,G){D.exports=function(U,W,q,Y){for(var K=65535&U|0,Z=U>>>16&65535|0,j=0;q!==0;){q-=j=q>2e3?2e3:q;do Z=Z+(K=K+W[Y++]|0)|0;while(--j);K%=65521,Z%=65521}return K|Z<<16|0}},{}],44:[function(F,D,G){D.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(F,D,G){var U=function(){for(var W,q=[],Y=0;Y<256;Y++){W=Y;for(var K=0;K<8;K++)W=1&W?3988292384^W>>>1:W>>>1;q[Y]=W}return q}();D.exports=function(W,q,Y,K){var Z=U,j=K+Y;W^=-1;for(var Q=K;Q>>8^Z[255&(W^q[Q])];return-1^W}},{}],46:[function(F,D,G){var U,W=F("../utils/common"),q=F("./trees"),Y=F("./adler32"),K=F("./crc32"),Z=F("./messages");function j(pe,be){return pe.msg=Z[be],be}function Q(pe){return(pe<<1)-(pe>4?9:0)}function J(pe){for(var be=pe.length;--be>=0;)pe[be]=0}function te(pe){var be=pe.state,xe=be.pending;xe>pe.avail_out&&(xe=pe.avail_out),xe!==0&&(W.arraySet(pe.output,be.pending_buf,be.pending_out,xe,pe.next_out),pe.next_out+=xe,be.pending_out+=xe,pe.total_out+=xe,pe.avail_out-=xe,be.pending-=xe,be.pending===0&&(be.pending_out=0))}function ne(pe,be){q._tr_flush_block(pe,pe.block_start>=0?pe.block_start:-1,pe.strstart-pe.block_start,be),pe.block_start=pe.strstart,te(pe.strm)}function ie(pe,be){pe.pending_buf[pe.pending++]=be}function re(pe,be){pe.pending_buf[pe.pending++]=be>>>8&255,pe.pending_buf[pe.pending++]=255&be}function oe(pe,be){var xe,ue,_e=pe.max_chain_length,Be=pe.strstart,Ae=pe.prev_length,Pe=pe.nice_match,Ie=pe.strstart>pe.w_size-262?pe.strstart-(pe.w_size-262):0,Ce=pe.window,Te=pe.w_mask,Se=pe.prev,Ne=pe.strstart+258,Ge=Ce[Be+Ae-1],ke=Ce[Be+Ae];pe.prev_length>=pe.good_match&&(_e>>=2),Pe>pe.lookahead&&(Pe=pe.lookahead);do if(Ce[(xe=be)+Ae]===ke&&Ce[xe+Ae-1]===Ge&&Ce[xe]===Ce[Be]&&Ce[++xe]===Ce[Be+1]){Be+=2,xe++;do;while(Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&Ce[++Be]===Ce[++xe]&&BeAe){if(pe.match_start=be,Ae=ue,ue>=Pe)break;Ge=Ce[Be+Ae-1],ke=Ce[Be+Ae]}}while((be=Se[be&Te])>Ie&&--_e!=0);return Ae<=pe.lookahead?Ae:pe.lookahead}function le(pe){var be,xe,ue,_e,Be,Ae,Pe,Ie,Ce,Te,Se=pe.w_size;do{if(_e=pe.window_size-pe.lookahead-pe.strstart,pe.strstart>=Se+(Se-262)){W.arraySet(pe.window,pe.window,Se,Se,0),pe.match_start-=Se,pe.strstart-=Se,pe.block_start-=Se,be=xe=pe.hash_size;do ue=pe.head[--be],pe.head[be]=ue>=Se?ue-Se:0;while(--xe);be=xe=Se;do ue=pe.prev[--be],pe.prev[be]=ue>=Se?ue-Se:0;while(--xe);_e+=Se}if(pe.strm.avail_in===0)break;if(Ae=pe.strm,Pe=pe.window,Ie=pe.strstart+pe.lookahead,Ce=_e,Te=void 0,(Te=Ae.avail_in)>Ce&&(Te=Ce),xe=Te===0?0:(Ae.avail_in-=Te,W.arraySet(Pe,Ae.input,Ae.next_in,Te,Ie),Ae.state.wrap===1?Ae.adler=Y(Ae.adler,Pe,Te,Ie):Ae.state.wrap===2&&(Ae.adler=K(Ae.adler,Pe,Te,Ie)),Ae.next_in+=Te,Ae.total_in+=Te,Te),pe.lookahead+=xe,pe.lookahead+pe.insert>=3)for(Be=pe.strstart-pe.insert,pe.ins_h=pe.window[Be],pe.ins_h=(pe.ins_h<=3&&(pe.ins_h=(pe.ins_h<=3)if(ue=q._tr_tally(pe,pe.strstart-pe.match_start,pe.match_length-3),pe.lookahead-=pe.match_length,pe.match_length<=pe.max_lazy_match&&pe.lookahead>=3){pe.match_length--;do pe.strstart++,pe.ins_h=(pe.ins_h<=3&&(pe.ins_h=(pe.ins_h<4096)&&(pe.match_length=2)),pe.prev_length>=3&&pe.match_length<=pe.prev_length){_e=pe.strstart+pe.lookahead-3,ue=q._tr_tally(pe,pe.strstart-1-pe.prev_match,pe.prev_length-3),pe.lookahead-=pe.prev_length-1,pe.prev_length-=2;do++pe.strstart<=_e&&(pe.ins_h=(pe.ins_h<15&&(Ae=2,ue-=16),_e<1||_e>9||xe!==8||ue<8||ue>15||be<0||be>9||Be<0||Be>4)return j(pe,-2);ue===8&&(ue=9);var Pe=new ce;return pe.state=Pe,Pe.strm=pe,Pe.wrap=Ae,Pe.gzhead=null,Pe.w_bits=ue,Pe.w_size=1<pe.pending_buf_size-5&&(xe=pe.pending_buf_size-5);;){if(pe.lookahead<=1){if(le(pe),pe.lookahead===0&&be===0)return 1;if(pe.lookahead===0)break}pe.strstart+=pe.lookahead,pe.lookahead=0;var ue=pe.block_start+xe;if((pe.strstart===0||pe.strstart>=ue)&&(pe.lookahead=pe.strstart-ue,pe.strstart=ue,ne(pe,!1),pe.strm.avail_out===0)||pe.strstart-pe.block_start>=pe.w_size-262&&(ne(pe,!1),pe.strm.avail_out===0))return 1}return pe.insert=0,be===4?(ne(pe,!0),pe.strm.avail_out===0?3:4):(pe.strstart>pe.block_start&&(ne(pe,!1),pe.strm.avail_out),1)}),new ge(4,4,8,4,fe),new ge(4,5,16,8,fe),new ge(4,6,32,32,fe),new ge(4,4,16,16,he),new ge(8,16,32,32,he),new ge(8,16,128,128,he),new ge(8,32,128,256,he),new ge(32,128,258,1024,he),new ge(32,258,258,4096,he)],G.deflateInit=function(pe,be){return ve(pe,be,8,15,8,0)},G.deflateInit2=ve,G.deflateReset=ye,G.deflateResetKeep=me,G.deflateSetHeader=function(pe,be){return pe&&pe.state?pe.state.wrap!==2?-2:(pe.state.gzhead=be,0):-2},G.deflate=function(pe,be){var xe,ue,_e,Be;if(!pe||!pe.state||be>5||be<0)return pe?j(pe,-2):-2;if(ue=pe.state,!pe.output||!pe.input&&pe.avail_in!==0||ue.status===666&&be!==4)return j(pe,pe.avail_out===0?-5:-2);if(ue.strm=pe,xe=ue.last_flush,ue.last_flush=be,ue.status===42)if(ue.wrap===2)pe.adler=0,ie(ue,31),ie(ue,139),ie(ue,8),ue.gzhead?(ie(ue,(ue.gzhead.text?1:0)+(ue.gzhead.hcrc?2:0)+(ue.gzhead.extra?4:0)+(ue.gzhead.name?8:0)+(ue.gzhead.comment?16:0)),ie(ue,255&ue.gzhead.time),ie(ue,ue.gzhead.time>>8&255),ie(ue,ue.gzhead.time>>16&255),ie(ue,ue.gzhead.time>>24&255),ie(ue,ue.level===9?2:ue.strategy>=2||ue.level<2?4:0),ie(ue,255&ue.gzhead.os),ue.gzhead.extra&&ue.gzhead.extra.length&&(ie(ue,255&ue.gzhead.extra.length),ie(ue,ue.gzhead.extra.length>>8&255)),ue.gzhead.hcrc&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending,0)),ue.gzindex=0,ue.status=69):(ie(ue,0),ie(ue,0),ie(ue,0),ie(ue,0),ie(ue,0),ie(ue,ue.level===9?2:ue.strategy>=2||ue.level<2?4:0),ie(ue,3),ue.status=113);else{var Ae=8+(ue.w_bits-8<<4)<<8;Ae|=(ue.strategy>=2||ue.level<2?0:ue.level<6?1:ue.level===6?2:3)<<6,ue.strstart!==0&&(Ae|=32),Ae+=31-Ae%31,ue.status=113,re(ue,Ae),ue.strstart!==0&&(re(ue,pe.adler>>>16),re(ue,65535&pe.adler)),pe.adler=1}if(ue.status===69)if(ue.gzhead.extra){for(_e=ue.pending;ue.gzindex<(65535&ue.gzhead.extra.length)&&(ue.pending!==ue.pending_buf_size||(ue.gzhead.hcrc&&ue.pending>_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),te(pe),_e=ue.pending,ue.pending!==ue.pending_buf_size));)ie(ue,255&ue.gzhead.extra[ue.gzindex]),ue.gzindex++;ue.gzhead.hcrc&&ue.pending>_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),ue.gzindex===ue.gzhead.extra.length&&(ue.gzindex=0,ue.status=73)}else ue.status=73;if(ue.status===73)if(ue.gzhead.name){_e=ue.pending;do{if(ue.pending===ue.pending_buf_size&&(ue.gzhead.hcrc&&ue.pending>_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),te(pe),_e=ue.pending,ue.pending===ue.pending_buf_size)){Be=1;break}Be=ue.gzindex_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),Be===0&&(ue.gzindex=0,ue.status=91)}else ue.status=91;if(ue.status===91)if(ue.gzhead.comment){_e=ue.pending;do{if(ue.pending===ue.pending_buf_size&&(ue.gzhead.hcrc&&ue.pending>_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),te(pe),_e=ue.pending,ue.pending===ue.pending_buf_size)){Be=1;break}Be=ue.gzindex_e&&(pe.adler=K(pe.adler,ue.pending_buf,ue.pending-_e,_e)),Be===0&&(ue.status=103)}else ue.status=103;if(ue.status===103&&(ue.gzhead.hcrc?(ue.pending+2>ue.pending_buf_size&&te(pe),ue.pending+2<=ue.pending_buf_size&&(ie(ue,255&pe.adler),ie(ue,pe.adler>>8&255),pe.adler=0,ue.status=113)):ue.status=113),ue.pending!==0){if(te(pe),pe.avail_out===0)return ue.last_flush=-1,0}else if(pe.avail_in===0&&Q(be)<=Q(xe)&&be!==4)return j(pe,-5);if(ue.status===666&&pe.avail_in!==0)return j(pe,-5);if(pe.avail_in!==0||ue.lookahead!==0||be!==0&&ue.status!==666){var Pe=ue.strategy===2?function(Ie,Ce){for(var Te;;){if(Ie.lookahead===0&&(le(Ie),Ie.lookahead===0)){if(Ce===0)return 1;break}if(Ie.match_length=0,Te=q._tr_tally(Ie,0,Ie.window[Ie.strstart]),Ie.lookahead--,Ie.strstart++,Te&&(ne(Ie,!1),Ie.strm.avail_out===0))return 1}return Ie.insert=0,Ce===4?(ne(Ie,!0),Ie.strm.avail_out===0?3:4):Ie.last_lit&&(ne(Ie,!1),Ie.strm.avail_out===0)?1:2}(ue,be):ue.strategy===3?function(Ie,Ce){for(var Te,Se,Ne,Ge,ke=Ie.window;;){if(Ie.lookahead<=258){if(le(Ie),Ie.lookahead<=258&&Ce===0)return 1;if(Ie.lookahead===0)break}if(Ie.match_length=0,Ie.lookahead>=3&&Ie.strstart>0&&(Se=ke[Ne=Ie.strstart-1])===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]){Ge=Ie.strstart+258;do;while(Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&Se===ke[++Ne]&&NeIe.lookahead&&(Ie.match_length=Ie.lookahead)}if(Ie.match_length>=3?(Te=q._tr_tally(Ie,1,Ie.match_length-3),Ie.lookahead-=Ie.match_length,Ie.strstart+=Ie.match_length,Ie.match_length=0):(Te=q._tr_tally(Ie,0,Ie.window[Ie.strstart]),Ie.lookahead--,Ie.strstart++),Te&&(ne(Ie,!1),Ie.strm.avail_out===0))return 1}return Ie.insert=0,Ce===4?(ne(Ie,!0),Ie.strm.avail_out===0?3:4):Ie.last_lit&&(ne(Ie,!1),Ie.strm.avail_out===0)?1:2}(ue,be):U[ue.level].func(ue,be);if(Pe!==3&&Pe!==4||(ue.status=666),Pe===1||Pe===3)return pe.avail_out===0&&(ue.last_flush=-1),0;if(Pe===2&&(be===1?q._tr_align(ue):be!==5&&(q._tr_stored_block(ue,0,0,!1),be===3&&(J(ue.head),ue.lookahead===0&&(ue.strstart=0,ue.block_start=0,ue.insert=0))),te(pe),pe.avail_out===0))return ue.last_flush=-1,0}return be!==4?0:ue.wrap<=0?1:(ue.wrap===2?(ie(ue,255&pe.adler),ie(ue,pe.adler>>8&255),ie(ue,pe.adler>>16&255),ie(ue,pe.adler>>24&255),ie(ue,255&pe.total_in),ie(ue,pe.total_in>>8&255),ie(ue,pe.total_in>>16&255),ie(ue,pe.total_in>>24&255)):(re(ue,pe.adler>>>16),re(ue,65535&pe.adler)),te(pe),ue.wrap>0&&(ue.wrap=-ue.wrap),ue.pending!==0?0:1)},G.deflateEnd=function(pe){var be;return pe&&pe.state?(be=pe.state.status)!==42&&be!==69&&be!==73&&be!==91&&be!==103&&be!==113&&be!==666?j(pe,-2):(pe.state=null,be===113?j(pe,-3):0):-2},G.deflateSetDictionary=function(pe,be){var xe,ue,_e,Be,Ae,Pe,Ie,Ce,Te=be.length;if(!pe||!pe.state||(Be=(xe=pe.state).wrap)===2||Be===1&&xe.status!==42||xe.lookahead)return-2;for(Be===1&&(pe.adler=Y(pe.adler,be,Te,0)),xe.wrap=0,Te>=xe.w_size&&(Be===0&&(J(xe.head),xe.strstart=0,xe.block_start=0,xe.insert=0),Ce=new W.Buf8(xe.w_size),W.arraySet(Ce,be,Te-xe.w_size,xe.w_size,0),be=Ce,Te=xe.w_size),Ae=pe.avail_in,Pe=pe.next_in,Ie=pe.input,pe.avail_in=Te,pe.next_in=0,pe.input=be,le(xe);xe.lookahead>=3;){ue=xe.strstart,_e=xe.lookahead-2;do xe.ins_h=(xe.ins_h<>>=ye=me>>>24,le-=ye,(ye=me>>>16&255)===0)_e[Z++]=65535&me;else{if(!(16&ye)){if((64&ye)==0){me=fe[(65535&me)+(oe&(1<>>=ye,le-=ye),le<15&&(oe+=ue[Y++]<>>=ye=me>>>24,le-=ye,!(16&(ye=me>>>16&255))){if((64&ye)==0){me=he[(65535&me)+(oe&(1<J){U.msg="invalid distance too far back",q.mode=30;break e}if(oe>>>=ye,le-=ye,pe>(ye=Z-j)){if((ye=pe-ye)>ne&&q.sane){U.msg="invalid distance too far back",q.mode=30;break e}if(be=0,xe=re,ie===0){if(be+=te-ye,ye2;)_e[Z++]=xe[be++],_e[Z++]=xe[be++],_e[Z++]=xe[be++],ve-=3;ve&&(_e[Z++]=xe[be++],ve>1&&(_e[Z++]=xe[be++]))}else{be=Z-pe;do _e[Z++]=_e[be++],_e[Z++]=_e[be++],_e[Z++]=_e[be++],ve-=3;while(ve>2);ve&&(_e[Z++]=_e[be++],ve>1&&(_e[Z++]=_e[be++]))}break}}break}}while(Y>3,oe&=(1<<(le-=ve<<3))-1,U.next_in=Y,U.next_out=Z,U.avail_in=Y>>24&255)+(he>>>8&65280)+((65280&he)<<8)+((255&he)<<24)}function j(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new U.Buf16(320),this.work=new U.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Q(he){var ge;return he&&he.state?(ge=he.state,he.total_in=he.total_out=ge.total=0,he.msg="",ge.wrap&&(he.adler=1&ge.wrap),ge.mode=1,ge.last=0,ge.havedict=0,ge.dmax=32768,ge.head=null,ge.hold=0,ge.bits=0,ge.lencode=ge.lendyn=new U.Buf32(852),ge.distcode=ge.distdyn=new U.Buf32(592),ge.sane=1,ge.back=-1,0):-2}function J(he){var ge;return he&&he.state?((ge=he.state).wsize=0,ge.whave=0,ge.wnext=0,Q(he)):-2}function te(he,ge){var ce,me;return he&&he.state?(me=he.state,ge<0?(ce=0,ge=-ge):(ce=1+(ge>>4),ge<48&&(ge&=15)),ge&&(ge<8||ge>15)?-2:(me.window!==null&&me.wbits!==ge&&(me.window=null),me.wrap=ce,me.wbits=ge,J(he))):-2}function ne(he,ge){var ce,me;return he?(me=new j,he.state=me,me.window=null,(ce=te(he,ge))!==0&&(he.state=null),ce):-2}var ie,re,oe=!0;function le(he){if(oe){var ge;for(ie=new U.Buf32(512),re=new U.Buf32(32),ge=0;ge<144;)he.lens[ge++]=8;for(;ge<256;)he.lens[ge++]=9;for(;ge<280;)he.lens[ge++]=7;for(;ge<288;)he.lens[ge++]=8;for(K(1,he.lens,0,288,ie,0,he.work,{bits:9}),ge=0;ge<32;)he.lens[ge++]=5;K(2,he.lens,0,32,re,0,he.work,{bits:5}),oe=!1}he.lencode=ie,he.lenbits=9,he.distcode=re,he.distbits=5}function fe(he,ge,ce,me){var ye,ve=he.state;return ve.window===null&&(ve.wsize=1<=ve.wsize?(U.arraySet(ve.window,ge,ce-ve.wsize,ve.wsize,0),ve.wnext=0,ve.whave=ve.wsize):((ye=ve.wsize-ve.wnext)>me&&(ye=me),U.arraySet(ve.window,ge,ce-me,ye,ve.wnext),(me-=ye)?(U.arraySet(ve.window,ge,ce-me,me,0),ve.wnext=me,ve.whave=ve.wsize):(ve.wnext+=ye,ve.wnext===ve.wsize&&(ve.wnext=0),ve.whave>>8&255,ce.check=q(ce.check,ft,2,0),ue=0,_e=0,ce.mode=2;break}if(ce.flags=0,ce.head&&(ce.head.done=!1),!(1&ce.wrap)||(((255&ue)<<8)+(ue>>8))%31){he.msg="incorrect header check",ce.mode=30;break}if((15&ue)!=8){he.msg="unknown compression method",ce.mode=30;break}if(_e-=4,We=8+(15&(ue>>>=4)),ce.wbits===0)ce.wbits=We;else if(We>ce.wbits){he.msg="invalid window size",ce.mode=30;break}ce.dmax=1<>8&1),512&ce.flags&&(ft[0]=255&ue,ft[1]=ue>>>8&255,ce.check=q(ce.check,ft,2,0)),ue=0,_e=0,ce.mode=3;case 3:for(;_e<32;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}ce.head&&(ce.head.time=ue),512&ce.flags&&(ft[0]=255&ue,ft[1]=ue>>>8&255,ft[2]=ue>>>16&255,ft[3]=ue>>>24&255,ce.check=q(ce.check,ft,4,0)),ue=0,_e=0,ce.mode=4;case 4:for(;_e<16;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}ce.head&&(ce.head.xflags=255&ue,ce.head.os=ue>>8),512&ce.flags&&(ft[0]=255&ue,ft[1]=ue>>>8&255,ce.check=q(ce.check,ft,2,0)),ue=0,_e=0,ce.mode=5;case 5:if(1024&ce.flags){for(;_e<16;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}ce.length=ue,ce.head&&(ce.head.extra_len=ue),512&ce.flags&&(ft[0]=255&ue,ft[1]=ue>>>8&255,ce.check=q(ce.check,ft,2,0)),ue=0,_e=0}else ce.head&&(ce.head.extra=null);ce.mode=6;case 6:if(1024&ce.flags&&((Pe=ce.length)>be&&(Pe=be),Pe&&(ce.head&&(We=ce.head.extra_len-ce.length,ce.head.extra||(ce.head.extra=new Array(ce.head.extra_len)),U.arraySet(ce.head.extra,me,ve,Pe,We)),512&ce.flags&&(ce.check=q(ce.check,me,Pe,ve)),be-=Pe,ve+=Pe,ce.length-=Pe),ce.length))break e;ce.length=0,ce.mode=7;case 7:if(2048&ce.flags){if(be===0)break e;Pe=0;do We=me[ve+Pe++],ce.head&&We&&ce.length<65536&&(ce.head.name+=String.fromCharCode(We));while(We&&Pe>9&1,ce.head.done=!0),he.adler=ce.check=0,ce.mode=12;break;case 10:for(;_e<32;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}he.adler=ce.check=Z(ue),ue=0,_e=0,ce.mode=11;case 11:if(ce.havedict===0)return he.next_out=pe,he.avail_out=xe,he.next_in=ve,he.avail_in=be,ce.hold=ue,ce.bits=_e,2;he.adler=ce.check=1,ce.mode=12;case 12:if(ge===5||ge===6)break e;case 13:if(ce.last){ue>>>=7&_e,_e-=7&_e,ce.mode=27;break}for(;_e<3;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}switch(ce.last=1&ue,_e-=1,3&(ue>>>=1)){case 0:ce.mode=14;break;case 1:if(le(ce),ce.mode=20,ge===6){ue>>>=2,_e-=2;break e}break;case 2:ce.mode=17;break;case 3:he.msg="invalid block type",ce.mode=30}ue>>>=2,_e-=2;break;case 14:for(ue>>>=7&_e,_e-=7&_e;_e<32;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if((65535&ue)!=(ue>>>16^65535)){he.msg="invalid stored block lengths",ce.mode=30;break}if(ce.length=65535&ue,ue=0,_e=0,ce.mode=15,ge===6)break e;case 15:ce.mode=16;case 16:if(Pe=ce.length){if(Pe>be&&(Pe=be),Pe>xe&&(Pe=xe),Pe===0)break e;U.arraySet(ye,me,ve,Pe,pe),be-=Pe,ve+=Pe,xe-=Pe,pe+=Pe,ce.length-=Pe;break}ce.mode=12;break;case 17:for(;_e<14;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if(ce.nlen=257+(31&ue),ue>>>=5,_e-=5,ce.ndist=1+(31&ue),ue>>>=5,_e-=5,ce.ncode=4+(15&ue),ue>>>=4,_e-=4,ce.nlen>286||ce.ndist>30){he.msg="too many length or distance symbols",ce.mode=30;break}ce.have=0,ce.mode=18;case 18:for(;ce.have>>=3,_e-=3}for(;ce.have<19;)ce.lens[lt[ce.have++]]=0;if(ce.lencode=ce.lendyn,ce.lenbits=7,qe={bits:ce.lenbits},Ve=K(0,ce.lens,0,19,ce.lencode,0,ce.work,qe),ce.lenbits=qe.bits,Ve){he.msg="invalid code lengths set",ce.mode=30;break}ce.have=0,ce.mode=19;case 19:for(;ce.have>>16&255,Ne=65535&ot,!((Te=ot>>>24)<=_e);){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if(Ne<16)ue>>>=Te,_e-=Te,ce.lens[ce.have++]=Ne;else{if(Ne===16){for(et=Te+2;_e>>=Te,_e-=Te,ce.have===0){he.msg="invalid bit length repeat",ce.mode=30;break}We=ce.lens[ce.have-1],Pe=3+(3&ue),ue>>>=2,_e-=2}else if(Ne===17){for(et=Te+3;_e>>=Te)),ue>>>=3,_e-=3}else{for(et=Te+7;_e>>=Te)),ue>>>=7,_e-=7}if(ce.have+Pe>ce.nlen+ce.ndist){he.msg="invalid bit length repeat",ce.mode=30;break}for(;Pe--;)ce.lens[ce.have++]=We}}if(ce.mode===30)break;if(ce.lens[256]===0){he.msg="invalid code -- missing end-of-block",ce.mode=30;break}if(ce.lenbits=9,qe={bits:ce.lenbits},Ve=K(1,ce.lens,0,ce.nlen,ce.lencode,0,ce.work,qe),ce.lenbits=qe.bits,Ve){he.msg="invalid literal/lengths set",ce.mode=30;break}if(ce.distbits=6,ce.distcode=ce.distdyn,qe={bits:ce.distbits},Ve=K(2,ce.lens,ce.nlen,ce.ndist,ce.distcode,0,ce.work,qe),ce.distbits=qe.bits,Ve){he.msg="invalid distances set",ce.mode=30;break}if(ce.mode=20,ge===6)break e;case 20:ce.mode=21;case 21:if(be>=6&&xe>=258){he.next_out=pe,he.avail_out=xe,he.next_in=ve,he.avail_in=be,ce.hold=ue,ce.bits=_e,Y(he,Ae),pe=he.next_out,ye=he.output,xe=he.avail_out,ve=he.next_in,me=he.input,be=he.avail_in,ue=ce.hold,_e=ce.bits,ce.mode===12&&(ce.back=-1);break}for(ce.back=0;Se=(ot=ce.lencode[ue&(1<>>16&255,Ne=65535&ot,!((Te=ot>>>24)<=_e);){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if(Se&&(240&Se)==0){for(Ge=Te,ke=Se,$e=Ne;Se=(ot=ce.lencode[$e+((ue&(1<>Ge)])>>>16&255,Ne=65535&ot,!(Ge+(Te=ot>>>24)<=_e);){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}ue>>>=Ge,_e-=Ge,ce.back+=Ge}if(ue>>>=Te,_e-=Te,ce.back+=Te,ce.length=Ne,Se===0){ce.mode=26;break}if(32&Se){ce.back=-1,ce.mode=12;break}if(64&Se){he.msg="invalid literal/length code",ce.mode=30;break}ce.extra=15&Se,ce.mode=22;case 22:if(ce.extra){for(et=ce.extra;_e>>=ce.extra,_e-=ce.extra,ce.back+=ce.extra}ce.was=ce.length,ce.mode=23;case 23:for(;Se=(ot=ce.distcode[ue&(1<>>16&255,Ne=65535&ot,!((Te=ot>>>24)<=_e);){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if((240&Se)==0){for(Ge=Te,ke=Se,$e=Ne;Se=(ot=ce.distcode[$e+((ue&(1<>Ge)])>>>16&255,Ne=65535&ot,!(Ge+(Te=ot>>>24)<=_e);){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}ue>>>=Ge,_e-=Ge,ce.back+=Ge}if(ue>>>=Te,_e-=Te,ce.back+=Te,64&Se){he.msg="invalid distance code",ce.mode=30;break}ce.offset=Ne,ce.extra=15&Se,ce.mode=24;case 24:if(ce.extra){for(et=ce.extra;_e>>=ce.extra,_e-=ce.extra,ce.back+=ce.extra}if(ce.offset>ce.dmax){he.msg="invalid distance too far back",ce.mode=30;break}ce.mode=25;case 25:if(xe===0)break e;if(Pe=Ae-xe,ce.offset>Pe){if((Pe=ce.offset-Pe)>ce.whave&&ce.sane){he.msg="invalid distance too far back",ce.mode=30;break}Pe>ce.wnext?(Pe-=ce.wnext,Ie=ce.wsize-Pe):Ie=ce.wnext-Pe,Pe>ce.length&&(Pe=ce.length),Ce=ce.window}else Ce=ye,Ie=pe-ce.offset,Pe=ce.length;Pe>xe&&(Pe=xe),xe-=Pe,ce.length-=Pe;do ye[pe++]=Ce[Ie++];while(--Pe);ce.length===0&&(ce.mode=21);break;case 26:if(xe===0)break e;ye[pe++]=ce.length,xe--,ce.mode=21;break;case 27:if(ce.wrap){for(;_e<32;){if(be===0)break e;be--,ue|=me[ve++]<<_e,_e+=8}if(Ae-=xe,he.total_out+=Ae,ce.total+=Ae,Ae&&(he.adler=ce.check=ce.flags?q(ce.check,ye,Ae,pe-Ae):W(ce.check,ye,Ae,pe-Ae)),Ae=xe,(ce.flags?ue:Z(ue))!==ce.check){he.msg="incorrect data check",ce.mode=30;break}ue=0,_e=0}ce.mode=28;case 28:if(ce.wrap&&ce.flags){for(;_e<32;){if(be===0)break e;be--,ue+=me[ve++]<<_e,_e+=8}if(ue!==(4294967295&ce.total)){he.msg="incorrect length check",ce.mode=30;break}ue=0,_e=0}ce.mode=29;case 29:Ve=1;break e;case 30:Ve=-3;break e;case 31:return-4;case 32:default:return-2}return he.next_out=pe,he.avail_out=xe,he.next_in=ve,he.avail_in=be,ce.hold=ue,ce.bits=_e,(ce.wsize||Ae!==he.avail_out&&ce.mode<30&&(ce.mode<27||ge!==4))&&fe(he,he.output,he.next_out,Ae-he.avail_out)?(ce.mode=31,-4):(Be-=he.avail_in,Ae-=he.avail_out,he.total_in+=Be,he.total_out+=Ae,ce.total+=Ae,ce.wrap&&Ae&&(he.adler=ce.check=ce.flags?q(ce.check,ye,Ae,he.next_out-Ae):W(ce.check,ye,Ae,he.next_out-Ae)),he.data_type=ce.bits+(ce.last?64:0)+(ce.mode===12?128:0)+(ce.mode===20||ce.mode===15?256:0),(Be===0&&Ae===0||ge===4)&&Ve===0&&(Ve=-5),Ve)},G.inflateEnd=function(he){if(!he||!he.state)return-2;var ge=he.state;return ge.window&&(ge.window=null),he.state=null,0},G.inflateGetHeader=function(he,ge){var ce;return he&&he.state?(2&(ce=he.state).wrap)==0?-2:(ce.head=ge,ge.done=!1,0):-2},G.inflateSetDictionary=function(he,ge){var ce,me=ge.length;return he&&he.state?(ce=he.state).wrap!==0&&ce.mode!==11?-2:ce.mode===11&&W(1,ge,me,0)!==ce.check?-3:fe(he,ge,me,me)?(ce.mode=31,-4):(ce.havedict=1,0):-2},G.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(F,D,G){var U=F("../utils/common"),W=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],q=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Y=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],K=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];D.exports=function(Z,j,Q,J,te,ne,ie,re){var oe,le,fe,he,ge,ce,me,ye,ve,pe=re.bits,be=0,xe=0,ue=0,_e=0,Be=0,Ae=0,Pe=0,Ie=0,Ce=0,Te=0,Se=null,Ne=0,Ge=new U.Buf16(16),ke=new U.Buf16(16),$e=null,We=0;for(be=0;be<=15;be++)Ge[be]=0;for(xe=0;xe=1&&Ge[_e]===0;_e--);if(Be>_e&&(Be=_e),_e===0)return te[ne++]=20971520,te[ne++]=20971520,re.bits=1,0;for(ue=1;ue<_e&&Ge[ue]===0;ue++);for(Be0&&(Z===0||_e!==1))return-1;for(ke[1]=0,be=1;be<15;be++)ke[be+1]=ke[be]+Ge[be];for(xe=0;xe852||Z===2&&Ce>592)return 1;for(;;){me=be-Pe,ie[xe]ce?(ye=$e[We+ie[xe]],ve=Se[Ne+ie[xe]]):(ye=96,ve=0),oe=1<>Pe)+(le-=oe)]=me<<24|ye<<16|ve|0;while(le!==0);for(oe=1<>=1;if(oe!==0?(Te&=oe-1,Te+=oe):Te=0,xe++,--Ge[be]==0){if(be===_e)break;be=j[Q+ie[xe]]}if(be>Be&&(Te&he)!==fe){for(Pe===0&&(Pe=Be),ge+=ue,Ie=1<<(Ae=be-Pe);Ae+Pe<_e&&!((Ie-=Ge[Ae+Pe])<=0);)Ae++,Ie<<=1;if(Ce+=1<852||Z===2&&Ce>592)return 1;te[fe=Te&he]=Be<<24|Ae<<16|ge-ne|0}}return Te!==0&&(te[ge+Te]=be-Pe<<24|64<<16|0),re.bits=Be,0}},{"../utils/common":41}],51:[function(F,D,G){D.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(F,D,G){var U=F("../utils/common");function W(Se){for(var Ne=Se.length;--Ne>=0;)Se[Ne]=0}var q=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Y=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],K=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=new Array(576);W(j);var Q=new Array(60);W(Q);var J=new Array(512);W(J);var te=new Array(256);W(te);var ne=new Array(29);W(ne);var ie,re,oe,le=new Array(30);function fe(Se,Ne,Ge,ke,$e){this.static_tree=Se,this.extra_bits=Ne,this.extra_base=Ge,this.elems=ke,this.max_length=$e,this.has_stree=Se&&Se.length}function he(Se,Ne){this.dyn_tree=Se,this.max_code=0,this.stat_desc=Ne}function ge(Se){return Se<256?J[Se]:J[256+(Se>>>7)]}function ce(Se,Ne){Se.pending_buf[Se.pending++]=255&Ne,Se.pending_buf[Se.pending++]=Ne>>>8&255}function me(Se,Ne,Ge){Se.bi_valid>16-Ge?(Se.bi_buf|=Ne<>16-Se.bi_valid,Se.bi_valid+=Ge-16):(Se.bi_buf|=Ne<>>=1,Ge<<=1;while(--Ne>0);return Ge>>>1}function pe(Se,Ne,Ge){var ke,$e,We=new Array(16),Ve=0;for(ke=1;ke<=15;ke++)We[ke]=Ve=Ve+Ge[ke-1]<<1;for($e=0;$e<=Ne;$e++){var qe=Se[2*$e+1];qe!==0&&(Se[2*$e]=ve(We[qe]++,qe))}}function be(Se){var Ne;for(Ne=0;Ne<286;Ne++)Se.dyn_ltree[2*Ne]=0;for(Ne=0;Ne<30;Ne++)Se.dyn_dtree[2*Ne]=0;for(Ne=0;Ne<19;Ne++)Se.bl_tree[2*Ne]=0;Se.dyn_ltree[512]=1,Se.opt_len=Se.static_len=0,Se.last_lit=Se.matches=0}function xe(Se){Se.bi_valid>8?ce(Se,Se.bi_buf):Se.bi_valid>0&&(Se.pending_buf[Se.pending++]=Se.bi_buf),Se.bi_buf=0,Se.bi_valid=0}function ue(Se,Ne,Ge,ke){var $e=2*Ne,We=2*Ge;return Se[$e]>1;Ge>=1;Ge--)_e(Se,We,Ge);$e=et;do Ge=Se.heap[1],Se.heap[1]=Se.heap[Se.heap_len--],_e(Se,We,1),ke=Se.heap[1],Se.heap[--Se.heap_max]=Ge,Se.heap[--Se.heap_max]=ke,We[2*$e]=We[2*Ge]+We[2*ke],Se.depth[$e]=(Se.depth[Ge]>=Se.depth[ke]?Se.depth[Ge]:Se.depth[ke])+1,We[2*Ge+1]=We[2*ke+1]=$e,Se.heap[1]=$e++,_e(Se,We,1);while(Se.heap_len>=2);Se.heap[--Se.heap_max]=Se.heap[1],function(ft,lt){var Ee,je,Ke,Oe,Fe,He,Qe=lt.dyn_tree,tt=lt.max_code,Xe=lt.stat_desc.static_tree,rt=lt.stat_desc.has_stree,dt=lt.stat_desc.extra_bits,ct=lt.stat_desc.extra_base,bt=lt.stat_desc.max_length,wt=0;for(Oe=0;Oe<=15;Oe++)ft.bl_count[Oe]=0;for(Qe[2*ft.heap[ft.heap_max]+1]=0,Ee=ft.heap_max+1;Ee<573;Ee++)(Oe=Qe[2*Qe[2*(je=ft.heap[Ee])+1]+1]+1)>bt&&(Oe=bt,wt++),Qe[2*je+1]=Oe,je>tt||(ft.bl_count[Oe]++,Fe=0,je>=ct&&(Fe=dt[je-ct]),He=Qe[2*je],ft.opt_len+=He*(Oe+Fe),rt&&(ft.static_len+=He*(Xe[2*je+1]+Fe)));if(wt!==0){do{for(Oe=bt-1;ft.bl_count[Oe]===0;)Oe--;ft.bl_count[Oe]--,ft.bl_count[Oe+1]+=2,ft.bl_count[bt]--,wt-=2}while(wt>0);for(Oe=bt;Oe!==0;Oe--)for(je=ft.bl_count[Oe];je!==0;)(Ke=ft.heap[--Ee])>tt||(Qe[2*Ke+1]!==Oe&&(ft.opt_len+=(Oe-Qe[2*Ke+1])*Qe[2*Ke],Qe[2*Ke+1]=Oe),je--)}}(Se,Ne),pe(We,ot,Se.bl_count)}function Pe(Se,Ne,Ge){var ke,$e,We=-1,Ve=Ne[1],qe=0,et=7,ot=4;for(Ve===0&&(et=138,ot=3),Ne[2*(Ge+1)+1]=65535,ke=0;ke<=Ge;ke++)$e=Ve,Ve=Ne[2*(ke+1)+1],++qe>=7;$e<30;$e++)for(le[$e]=We<<7,Ne=0;Ne<1<0?(Se.strm.data_type===2&&(Se.strm.data_type=function(qe){var et,ot=4093624447;for(et=0;et<=31;et++,ot>>>=1)if(1&ot&&qe.dyn_ltree[2*et]!==0)return 0;if(qe.dyn_ltree[18]!==0||qe.dyn_ltree[20]!==0||qe.dyn_ltree[26]!==0)return 1;for(et=32;et<256;et++)if(qe.dyn_ltree[2*et]!==0)return 1;return 0}(Se)),Ae(Se,Se.l_desc),Ae(Se,Se.d_desc),Ve=function(qe){var et;for(Pe(qe,qe.dyn_ltree,qe.l_desc.max_code),Pe(qe,qe.dyn_dtree,qe.d_desc.max_code),Ae(qe,qe.bl_desc),et=18;et>=3&&qe.bl_tree[2*Z[et]+1]===0;et--);return qe.opt_len+=3*(et+1)+5+5+4,et}(Se),$e=Se.opt_len+3+7>>>3,(We=Se.static_len+3+7>>>3)<=$e&&($e=We)):$e=We=Ge+5,Ge+4<=$e&&Ne!==-1?Te(Se,Ne,Ge,ke):Se.strategy===4||We===$e?(me(Se,2+(ke?1:0),3),Be(Se,j,Q)):(me(Se,4+(ke?1:0),3),function(qe,et,ot,ft){var lt;for(me(qe,et-257,5),me(qe,ot-1,5),me(qe,ft-4,4),lt=0;lt>>8&255,Se.pending_buf[Se.d_buf+2*Se.last_lit+1]=255&Ne,Se.pending_buf[Se.l_buf+Se.last_lit]=255&Ge,Se.last_lit++,Ne===0?Se.dyn_ltree[2*Ge]++:(Se.matches++,Ne--,Se.dyn_ltree[2*(te[Ge]+256+1)]++,Se.dyn_dtree[2*ge(Ne)]++),Se.last_lit===Se.lit_bufsize-1},G._tr_align=function(Se){me(Se,2,3),ye(Se,256,j),function(Ne){Ne.bi_valid===16?(ce(Ne,Ne.bi_buf),Ne.bi_buf=0,Ne.bi_valid=0):Ne.bi_valid>=8&&(Ne.pending_buf[Ne.pending++]=255&Ne.bi_buf,Ne.bi_buf>>=8,Ne.bi_valid-=8)}(Se)}},{"../utils/common":41}],53:[function(F,D,G){D.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(F,D,G){(function(U){(function(W,q){if(!W.setImmediate){var Y,K,Z,j,Q,J=1,te={},ne=!1,ie=W.document,re=Object.getPrototypeOf&&Object.getPrototypeOf(W);re=re&&re.setTimeout?re:W,{}.toString.call(W.process)==="[object process]"?Y=function(fe){process.nextTick(function(){le(fe)})}:function(){if(W.postMessage&&!W.importScripts){var fe=!0,he=W.onmessage;return W.onmessage=function(){fe=!1},W.postMessage("","*"),W.onmessage=he,fe}}()?(j="setImmediate$"+Math.random()+"$",Q=function(fe){fe.source===W&&typeof fe.data=="string"&&fe.data.indexOf(j)===0&&le(+fe.data.slice(j.length))},W.addEventListener?W.addEventListener("message",Q,!1):W.attachEvent("onmessage",Q),Y=function(fe){W.postMessage(j+fe,"*")}):W.MessageChannel?((Z=new MessageChannel).port1.onmessage=function(fe){le(fe.data)},Y=function(fe){Z.port2.postMessage(fe)}):ie&&"onreadystatechange"in ie.createElement("script")?(K=ie.documentElement,Y=function(fe){var he=ie.createElement("script");he.onreadystatechange=function(){le(fe),he.onreadystatechange=null,K.removeChild(he),he=null},K.appendChild(he)}):Y=function(fe){setTimeout(le,0,fe)},re.setImmediate=function(fe){typeof fe!="function"&&(fe=new Function(""+fe));for(var he=new Array(arguments.length-1),ge=0;ge{const D=new XMLHttpRequest;D.open("GET",B,!0),D.responseType="arraybuffer",D.send(),D.onreadystatechange=function(){D.readyState==4&&D.status==200&&jszip.loadAsync(D.response).then(G=>{G.file("manifest.json").async("string").then(U=>{const W=JSON.parse(U);if(!("animations"in W))throw new Error("Manifest not found");if(W.animations.length===0)throw new Error("No animations listed in the manifest");const q=W.animations[0];G.file("animations/".concat(q.id,".json")).async("string").then(Y=>{const K=JSON.parse(Y);"assets"in K&&Promise.all(K.assets.map(Z=>{if(Z.p&&G.file("images/".concat(Z.p))!=null)return new Promise(j=>{const Q=Z.p.split(".").pop();G.file("images/".concat(Z.p)).async("base64").then(J=>{Z.p=Q==="svg"||Q==="svg+xml"?"data:image/svg+xml;base64,"+J:"data:;base64,"+J,Z.e=1,j()})})})).then(()=>{R(K)})})})}).catch(G=>{F(G)})}})}(function(B){B.Loading="loading",B.Playing="playing",B.Paused="paused",B.Stopped="stopped",B.Frozen="frozen",B.Error="error"})(PlayerState||(PlayerState={})),function(B){B.Normal="normal",B.Bounce="bounce"}(PlayMode||(PlayMode={})),function(B){B.Load="load",B.Error="error",B.Ready="ready",B.Play="play",B.Pause="pause",B.Stop="stop",B.Freeze="freeze",B.Loop="loop",B.Complete="complete",B.Frame="frame"}(PlayerEvents||(PlayerEvents={}));let DotLottiePlayer=class extends s$4{constructor(){super(...arguments),this.mode=PlayMode.Normal,this.autoplay=!1,this.background="transparent",this.controls=!1,this.direction=1,this.hover=!1,this.loop=!1,this.renderer="svg",this.speed=1,this.currentState=PlayerState.Loading,this.intermission=1,this._counter=0}_onVisibilityChange(){document.hidden&&this.currentState===PlayerState.Playing?this.freeze():this.currentState===PlayerState.Frozen&&this.play()}_handleSeekChange(B){if(!this._lottie||isNaN(B.target.value))return;const R=B.target.value/100*this._lottie.totalFrames;this.seek(R)}async load(B){if(!this.shadowRoot)return;const R={container:this.container,loop:!1,autoplay:!1,renderer:this.renderer,rendererSettings:{scaleMode:"noScale",clearCanvas:!1,progressiveLoad:!0,hideOnTransparent:!0}};try{const F=await fetchPath(B);this._lottie&&this._lottie.destroy(),this._lottie=lottie_svg.loadAnimation(Object.assign(Object.assign({},R),{animationData:F}))}catch{return this.currentState=PlayerState.Error,void this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}this._lottie&&(this._lottie.addEventListener("enterFrame",()=>{this.seeker=this._lottie.currentFrame/this._lottie.totalFrames*100,this.dispatchEvent(new CustomEvent(PlayerEvents.Frame,{detail:{frame:this._lottie.currentFrame,seeker:this.seeker}}))}),this._lottie.addEventListener("complete",()=>{this.currentState===PlayerState.Playing?!this.loop||this.count&&this._counter>=this.count?this.dispatchEvent(new CustomEvent(PlayerEvents.Complete)):this.mode===PlayMode.Bounce?(this.count&&(this._counter+=.5),setTimeout(()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Loop)),this.currentState===PlayerState.Playing&&(this._lottie.setDirection(-1*this._lottie.playDirection),this._lottie.play())},this.intermission)):(this.count&&(this._counter+=1),window.setTimeout(()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Loop)),this.currentState===PlayerState.Playing&&(this._lottie.stop(),this._lottie.play())},this.intermission)):this.dispatchEvent(new CustomEvent(PlayerEvents.Complete))}),this._lottie.addEventListener("DOMLoaded",()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Ready))}),this._lottie.addEventListener("data_ready",()=>{this.dispatchEvent(new CustomEvent(PlayerEvents.Load))}),this._lottie.addEventListener("data_failed",()=>{this.currentState=PlayerState.Error,this.dispatchEvent(new CustomEvent(PlayerEvents.Error))}),this.container.addEventListener("mouseenter",()=>{this.hover&&this.currentState!==PlayerState.Playing&&this.play()}),this.container.addEventListener("mouseleave",()=>{this.hover&&this.currentState===PlayerState.Playing&&this.stop()}),this.setSpeed(this.speed),this.setDirection(this.direction),this.autoplay&&this.play())}getLottie(){return this._lottie}play(){this._lottie&&(this._lottie.play(),this.currentState=PlayerState.Playing,this.dispatchEvent(new CustomEvent(PlayerEvents.Play)))}pause(){this._lottie&&(this._lottie.pause(),this.currentState=PlayerState.Paused,this.dispatchEvent(new CustomEvent(PlayerEvents.Pause)))}stop(){this._lottie&&(this._counter=0,this._lottie.stop(),this.currentState=PlayerState.Stopped,this.dispatchEvent(new CustomEvent(PlayerEvents.Stop)))}seek(B){if(!this._lottie)return;const R=B.toString().match(/^([0-9]+)(%?)$/);if(!R)return;const F=R[2]==="%"?this._lottie.totalFrames*Number(R[1])/100:R[1];this.seeker=F,this.currentState===PlayerState.Playing?this._lottie.goToAndPlay(F,!0):(this._lottie.goToAndStop(F,!0),this._lottie.pause())}snapshot(){let B=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];if(!this.shadowRoot)return;const R=this.shadowRoot.querySelector(".animation svg"),F=new XMLSerializer().serializeToString(R);if(B){const D=document.createElement("a");D.href="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(F),D.download="download_"+this.seeker+".svg",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return F}freeze(){this._lottie&&(this._lottie.pause(),this.currentState=PlayerState.Frozen,this.dispatchEvent(new CustomEvent(PlayerEvents.Freeze)))}setSpeed(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this._lottie&&this._lottie.setSpeed(B)}setDirection(B){this._lottie&&this._lottie.setDirection(B)}setLooping(B){this._lottie&&(this.loop=B,this._lottie.loop=B)}togglePlay(){return this.currentState===PlayerState.Playing?this.pause():this.play()}toggleLooping(){this.setLooping(!this.loop)}static get styles(){return styles$9}async firstUpdated(){"IntersectionObserver"in window&&(this._io=new IntersectionObserver(B=>{B[0].isIntersecting?this.currentState===PlayerState.Frozen&&this.play():this.currentState===PlayerState.Playing&&this.freeze()}),this._io.observe(this.container)),document.hidden!==void 0&&document.addEventListener("visibilitychange",()=>this._onVisibilityChange()),this.src&&await this.load(this.src)}disconnectedCallback(){this._io&&(this._io.disconnect(),this._io=void 0),document.removeEventListener("visibilitychange",()=>this._onVisibilityChange())}renderControls(){const B=this.currentState===PlayerState.Playing,R=this.currentState===PlayerState.Paused,F=this.currentState===PlayerState.Stopped;return $(_templateObject||(_templateObject=_taggedTemplateLiteral([`
`])),this.togglePlay,B||R?"active":"",$(B?_templateObject2||(_templateObject2=_taggedTemplateLiteral([` `])):_templateObject3||(_templateObject3=_taggedTemplateLiteral([` `]))),this.stop,F?"active":"",this.seeker,this._handleSeekChange,()=>{this._prevState=this.currentState,this.freeze()},()=>{this._prevState===PlayerState.Playing&&this.play()},this.seeker,this.toggleLooping,this.loop?"active":"")}render(){const B=this.controls?"main controls":"main",R=this.controls?"animation controls":"animation";return $(_templateObject4||(_templateObject4=_taggedTemplateLiteral([` `])),B,R,this.background,this.currentState===PlayerState.Error?$(_templateObject5||(_templateObject5=_taggedTemplateLiteral([`
\u26A0\uFE0F
`]))):void 0,this.controls?this.renderControls():void 0)}};__decorate([i$4(".animation")],DotLottiePlayer.prototype,"container",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"mode",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"autoplay",void 0),__decorate([e$5({type:String,reflect:!0})],DotLottiePlayer.prototype,"background",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"controls",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"count",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"direction",void 0),__decorate([e$5({type:Boolean})],DotLottiePlayer.prototype,"hover",void 0),__decorate([e$5({type:Boolean,reflect:!0})],DotLottiePlayer.prototype,"loop",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"renderer",void 0),__decorate([e$5({type:Number})],DotLottiePlayer.prototype,"speed",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"src",void 0),__decorate([e$5({type:String})],DotLottiePlayer.prototype,"currentState",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"seeker",void 0),__decorate([e$5()],DotLottiePlayer.prototype,"intermission",void 0),DotLottiePlayer=__decorate([n$1("dotlottie-player")],DotLottiePlayer);var StartEvaluating="/orchestra-music-score/assets/start-evaluating.7994767f.lottie",Recording="/orchestra-music-score/assets/recording2.feb0931b.lottie";const container$1="_container_yu37e_1",moreButton="_moreButton_yu37e_30",centerButton="_centerButton_yu37e_34",leftButton="_leftButton_yu37e_39",title$2="_title_yu37e_51",album="_album_yu37e_55",button$1="_button_yu37e_59",hasText$1="_hasText_yu37e_67",bigIcon$1="_bigIcon_yu37e_90",evaluatBtn="_evaluatBtn_yu37e_97",start$2="_start_yu37e_100",icon="_icon_yu37e_115",onShow="_onShow_yu37e_118",popover="_popover_yu37e_121",backbtn="_backbtn_yu37e_128",titleWrap="_titleWrap_yu37e_134",speed="_speed_yu37e_137",schedule="_schedule_yu37e_176",ring="_ring_yu37e_182",speedButton="_speedButton_yu37e_192",label="_label_yu37e_195",player="_player_yu37e_206",fullbtn="_fullbtn_yu37e_214",finish="_finish_yu37e_223",dialogueBox="_dialogueBox_yu37e_273",dialogue="_dialogue_yu37e_273",inRadio="_inRadio_yu37e_299",animation="_animation_yu37e_315",btnMusicList="_btnMusicList_yu37e_320",toggleMusicType="_toggleMusicType_yu37e_332",slider$1="_slider_yu37e_365",followEndBtn="_followEndBtn_yu37e_392";var styles$8={container:container$1,moreButton,centerButton,leftButton,title:title$2,album,button:button$1,hasText:hasText$1,bigIcon:bigIcon$1,evaluatBtn,start:start$2,icon,onShow,popover,backbtn,titleWrap,speed,schedule,ring,speedButton,label,player,fullbtn,finish,dialogueBox,dialogue,inRadio,animation,btnMusicList,toggleMusicType,slider:slider$1,followEndBtn};let backtime=0;const search$4=useOriginSearch(),initBehaviorId$2=""+new Date().valueOf(),evaluating=ref(!1),playStatus=ref("stop"),endloading=ref(!1),connentLoading=ref(!1),playUrl=ref(""),endResult=ref(null),animate$1={mounted:B=>{B.addEventListener("click",R=>{R.target.classList.add("animate__animated","animate__tada")}),B.addEventListener("animationend",R=>{R.target.classList.remove("animate__animated","animate__tada")})}},browserInfo$3=browser(),formatPitch=B=>B?state$4.sett.hertz&&state$4.sett.hertz!==442?B/442*state$4.sett.hertz:B:-1,formatTimes=()=>{var U,W,q,Y,K,Z,j,Q,J,te;const B=((W=(U=state$2.times)==null?void 0:U[0])==null?void 0:W.difftime)||0;let R=!1,F=!1,D=!1;const G=[];for(let ne=0;ne{var U,W,q,Y;connentLoading.value=!0;const B=sessionStorage.getItem("behaviorId")||search$4.behaviorId||initBehaviorId$2,R=state.speed/state$2.baseSpeed,F={musicXmlInfos:formatTimes(),subjectId:state$2.subjectId,detailId:(U=state$2.activeDetail)==null?void 0:U.id,examSongId:search$4.id,xmlUrl:(W=state$2==null?void 0:state$2.activeDetail)==null?void 0:W.xmlUrl,partIndex:state$2.partIndex,behaviorId:B,platform:"WEB",clientId:"student",hertz:state$4.sett.hertz,reactionTimeMs:parseFloat(""+state$4.eva.reactionTimeMs)||0,speed:state.speed,heardLevel:state$4.eva.difficulty,beatLength:Math.round(getFixTime(state$2.times[0].beatSpeed)*1e3/R)},D=useClientType();D==="student"?F.clientId="student":D==="teacher"?F.clientId="teacher":F.clientId="education",browserInfo$3.android&&(F.platform="ANDROID"),browserInfo$3.ios&&(F.platform="IOS");const G=await promisefiyPostMessage({api:"startEvaluating",content:F});if((q=G==null?void 0:G.content)!=null&&q.reson)throw Toast.fail({message:(Y=G==null?void 0:G.content)==null?void 0:Y.reson}),connentLoading.value=!1,G;connentLoading.value=!1},sendOffsetTime=B=>{postMessage({api:"proxyServiceMessage",content:{header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:B}}},()=>{backtime=0})},cancelTheEvaluation=()=>{resetPlayStatus(),clearIntervalTimeline(),setCurrentTime(0),playStatus.value="stop",postMessage({api:"endEvaluating",content:{musicScoreId:search$4.id}},B=>{evaluating.value=!1,Toast.clear()})},stopPlay=(B=!0)=>{console.log("\u8C03\u7528stopPlay"),startButtonShow.value=!0,cancelTheEvaluation()},evaluatStopPlay=stopPlay,startPlay=()=>{console.log("\u8FDE\u63A5\u670D\u52A1\u6210\u529F,\u5F00\u59CB\u64AD\u653E",new Date().getTime()-state.clickTime),state$4.eva.mute?changeMode("background"):changeAllMode(),startButtonShow.value=!1,setPlayState()},setPlayer=async()=>{if(console.log("\u8C03\u7528setPlayer"),state.clickTime=new Date().getTime(),resetPlayStatus(),state.evaluatingTips=!1,state$2.isPauseRecording){evaluating.value=!1,startPlay();return}state$2.evaluatings={},setCurrentTime(0);const B=Toast({duration:0,message:"\u670D\u52A1\u8FDE\u63A5\u4E2D...",type:"loading"});try{await connect(),startPlay(),setTimeout(()=>{Toast.clear(),B.close()},100)}catch{state.evaluatingStatus=!1,Toast.clear()}},togglePlay=()=>{if(state$2.isPauseRecording){evaluating.value=!1,startPlay();return}evaluating.value?stopPlay():setPlayer()},cancelEvaluating=B=>{B!=null&&B.content.reson&&stopPlay()},timeupdate=()=>{var B;if(console.log("\u64AD\u653E\u4E8B\u4EF6\u88AB\u89E6\u53D1",playUrl.value,evaluating.value),playUrl.value){const R=new Date().getTime();console.log("\u7B2C\u4E00\u6B21\u64AD\u653E\u65F6\u95F4",R);const F=(B=state.audiosInstance)==null?void 0:B.audios[playUrl.value].currentTime;console.log("\u5DF2\u64AD\u653E\u65F6\u957F: ",F*1e3),console.log("\u4E0D\u51CF\u6389\u5DF2\u64AD\u653E\u65F6\u95F4: ",R-backtime);const D=R-backtime-F*1e3;console.log("\u771F\u6B63\u64AD\u653E\u5EF6\u8FDF",D),setTimeout(()=>{sendOffsetTime(D)},220)}},playerStop=()=>{console.log("playerStop\u64AD\u653E\u5668\u505C\u6B62\u4E8B\u4EF6",endloading.value),!endloading.value&&(playStatus.value="stop",endloading.value=!0,startButtonShow.value=!0,resetPlayStatus(),clearIntervalTimeline(),setCurrentTime(0),Toast({duration:0,message:"\u8BC4\u5206\u4E2D...",type:"loading"}),postMessage({api:"endEvaluating",content:{musicScoreId:useOriginSearch().id}},B=>{console.log("\u8C03\u7528endEvaluating\u7ED3\u675F",B),endloading.value=!1,evaluating.value=!1}))},evaluatPlayerStop=playerStop,endevent=B=>{var R;((R=B.target)==null?void 0:R.src)===playUrl.value&&playStatus.value==="play"&&(playerStop(),canSubmit.value=!0),state$2.isAppPlay&&(playerStop(),canSubmit.value=!0)},start$1=()=>{if(playStatus.value="play",state$2.isPauseRecording){postMessage({api:"resumeRecording"},()=>{evaluating.value=!0,state$2.isPauseRecording=!1,setCaptureMode()});return}console.log("\u5F00\u59CB\u5F55\u97F3",new Date().getTime()),postMessage({api:"startRecording"},()=>{var B,R;console.log("\u5F00\u59CB\u5F55\u97F3\u56DE\u8C03\u65F6\u95F4",new Date().getTime()),backtime=new Date().getTime(),evaluating.value=!0,console.log("midiUrl",(B=state$2.activeDetail)==null?void 0:B.midiUrl),(R=state$2.activeDetail)!=null&&R.midiUrl&&setTimeout(()=>{sendOffsetTime(0)},220)})},submitEvaluationScore=async B=>{if(state$2.setting&&state$2.setting.mode==="EVALUATING"){if(!canSubmit.value){Toast("\u8BF7\u5B8C\u6210\u6574\u9996\u66F2\u76EE\u8BC4\u6D4B\uFF01");return}try{await request.post("/activity/evaluationScore",{requestType:"json",data:{userId:state$3.user.userId,score:B.score,...state$2.setting.submitData}})}catch{}canSubmit.value=!1}},canSubmit=ref(!1),sendResult=B=>{var R,F;if(console.log("\u8BC4\u6D4B\u8FD4\u56DE",B==null?void 0:B.content),B!=null&&B.content){const D=(R=B==null?void 0:B.content)==null?void 0:R.body;if((B==null?void 0:B.content.header.commond)==="overall")Toast.clear(),endResult.value=D,evaluatingShow.value=!0,submitEvaluationScore(D);else if((B==null?void 0:B.content.header.commond)!=="checkDone"){if((B==null?void 0:B.content.header.commond)!=="checking"){const G=W=>{for(;W>=0;){const q=state$2.times[W];if(q.stave)return q;W--}},U=(W,q,Y=!1)=>{const K=getBoundingBoxByverticalNote(W);console.log(state$2.evaluatings,K),state$2.evaluatings={...state$2.evaluatings,[K.measureIndex]:{...K,...getLeveByScoreMeasure(q.score),score:q.score,dontTransition:Y}}};for(let W=0;W{var B;state.currentTimeNum>=((B=state$2.times[state$2.times.length-1])==null?void 0:B.time)-2&&(canSubmit.value=!0)},cloudMetronome=B=>{startButtonShow.value=!0};var Evaluating$1=defineComponent({name:"ColexiuEvaluating",directives:{animate:animate$1},setup(B,{expose:R}){return onMounted(async()=>{var F,D,G,U;state.evaluatingTips=!0,state$2.section=[],state$2.sectionStatus=!1,changeAllMode(),playUrl.value=state.songs.background||state.songs.music,(D=(F=state.audiosInstance)==null?void 0:F.audios[playUrl.value])==null||D.addEventListener("play",timeupdate),(U=(G=state.audiosInstance)==null?void 0:G.audios[playUrl.value])==null||U.addEventListener("timeupdate",onProgress),event.on("next-click",playerStop),event.on("ended",endevent),listenerMessage("sendResult",sendResult),listenerMessage("cancelEvaluating",cancelEvaluating),listenerMessage("cloudTimeUpdae",onProgress),event.on("tickDestroy",cloudMetronome),event.on("tickEnd",start$1),await pause(),setCurrentTime(0)}),onBeforeUnmount(()=>{var F,D,G,U;(D=(F=state.audiosInstance)==null?void 0:F.audios[playUrl.value])==null||D.removeEventListener("play",timeupdate),(U=(G=state.audiosInstance)==null?void 0:G.audios[playUrl.value])==null||U.removeEventListener("timeupdate",onProgress),event.off("next-click",playerStop),event.off("ended",endevent),event.off("tickDestroy",cloudMetronome),removeListenerMessage("sendResult",sendResult),removeListenerMessage("cancelEvaluating",cancelEvaluating),removeListenerMessage("cloudTimeUpdae",onProgress),event.off("tickEnd",start$1)}),R({setPlayer,startPlay,stopPlay,togglePlay,playerStop,evaluating,connentLoading,playStatus,cancelTheEvaluation}),()=>createVNode(Fragment,null,[withDirectives(createVNode(Button,{class:[styles$8.button,styles$8.hasText],style:{display:state$2.frozenMode?"none":""},onClick:()=>{state.evaluatingStatus=!1,(playStatus.value==="play"||playStatus.value==="connecting")&&cancelTheEvaluation()}},{default:()=>[createVNode(ButtonIcon,{name:"practise"},null),createVNode("span",null,[createTextVNode("\u7EC3\u4E60")])]}),[[resolveDirective("animate")]]),createVNode(Evaluating,{data:endResult.value},null),evaluating.value?createVNode(Teleport,{to:"body",key:"Recording"},{default:()=>[createVNode("div",{class:styles$8.dialogueBox},[createVNode("div",{class:styles$8.inRadio},[createTextVNode("\u6536\u97F3\u4E2D...")]),createVNode(resolveComponent("dotlottie-player"),{src:Recording,autoplay:!0,loop:!0,class:styles$8.animation},null)])]}):createVNode(Teleport,{to:"body",key:"StartEvaluating"},{default:()=>[createVNode("div",{class:styles$8.dialogueBox},[createVNode("div",{class:styles$8.dialogue},[createVNode("div",null,[createTextVNode("\u6F14\u594F\u524D\u8BF7\u8C03\u6574\u597D\u4E50\u5668\uFF0C\u4FDD\u8BC1\u6700\u4F73\u6F14\u594F\u72B6\u6001\u3002"),createVNode("span",{class:styles$8.triangle},null)])]),createVNode(resolveComponent("dotlottie-player"),{src:StartEvaluating,autoplay:!0,loop:!0,class:styles$8.animation},null)])]})])}}),InfoIcon="/orchestra-music-score/assets/info.df4a2cca.svg",iconTv="/orchestra-music-score/assets/tv.e0e4a552.svg",iconYijian="/orchestra-music-score/assets/yijian.93a8e5bd.svg";const setting="_setting_18qx2_1",sliderWrap="_sliderWrap_18qx2_45",slider="_slider_18qx2_45",noticebar="_noticebar_18qx2_68",groupBox="_groupBox_18qx2_74",btnsbar="_btnsbar_18qx2_93",btn="_btn_18qx2_93",radioGroup="_radioGroup_18qx2_124";var styles$7={setting,sliderWrap,slider,noticebar,groupBox,btnsbar,btn,radioGroup};const tabs="_tabs_e40bs_1";var styles$6={tabs};const show=ref(!1);var HelperPopup=defineComponent({name:"HelperPopup",setup(){return()=>createVNode(Popup,{show:show.value,position:"right",round:!0,teleport:"body",onClickOverlay:()=>show.value=!1,style:{height:"100vh",width:"40vw",overflow:"hidden"}},{default:()=>[createVNode(Tabs,{class:styles$6.tabs},{default:()=>[createVNode(Tab,{title:"\u6295\u5C4F"},{default:()=>[createVNode("iframe",{src:location.origin+"/student/#/guide"},null)]}),createVNode(Tab,{title:"\u5E2E\u52A9"},{default:()=>[createVNode("iframe",{src:location.origin+"/student/#/helpCenter?platformType=ANALYSIS"},null)]})]})]})}}),raf$1={exports:{}},performanceNow={exports:{}};(function(){var B,R,F,D,G,U;typeof performance!="undefined"&&performance!==null&&performance.now?performanceNow.exports=function(){return performance.now()}:typeof process!="undefined"&&process!==null&&process.hrtime?(performanceNow.exports=function(){return(B()-G)/1e6},R=process.hrtime,B=function(){var W;return W=R(),W[0]*1e9+W[1]},D=B(),U=process.uptime()*1e9,G=D-U):Date.now?(performanceNow.exports=function(){return Date.now()-F},F=Date.now()):(performanceNow.exports=function(){return new Date().getTime()-F},F=new Date().getTime())}).call(commonjsGlobal$1);var now=performanceNow.exports,root=typeof window=="undefined"?commonjsGlobal$1:window,vendors=["moz","webkit"],suffix="AnimationFrame",raf=root["request"+suffix],caf=root["cancel"+suffix]||root["cancelRequest"+suffix];for(var i$1=0;!raf&&i$13&&(this.alpha=q[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var Y=this.r.toString(16),K=this.g.toString(16),Z=this.b.toString(16);return Y.length==1&&(Y="0"+Y),K.length==1&&(K="0"+K),Z.length==1&&(Z="0"+Z),"#"+Y+K+Z},this.getHelpXML=function(){for(var Y=new Array,K=0;K "+ne.toRGB()+" -> "+ne.toHex());te.appendChild(ie),te.appendChild(re),J.appendChild(te)}catch{}return J}};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var t=function(B,R){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,D){F.__proto__=D}||function(F,D){for(var G in D)Object.prototype.hasOwnProperty.call(D,G)&&(F[G]=D[G])})(B,R)};function r(B,R){if(typeof R!="function"&&R!==null)throw new TypeError("Class extends value "+String(R)+" is not a constructor or null");function F(){this.constructor=B}t(B,R),B.prototype=R===null?Object.create(R):(F.prototype=R.prototype,new F)}function e(B){var R="";Array.isArray(B)||(B=[B]);for(var F=0;FB.phi1&&(B.phi2-=2*n),B.sweepFlag===1&&B.phi2D)return[];if(D===0)return[[B*F/(B*B+R*R),R*F/(B*B+R*R)]];var G=Math.sqrt(D);return[[(B*F+R*G)/(B*B+R*R),(R*F-B*G)/(B*B+R*R)],[(B*F-R*G)/(B*B+R*R),(R*F+B*G)/(B*B+R*R)]]}var u,h=Math.PI/180;function c$1(B,R,F){return(1-F)*B+F*R}function y(B,R,F,D){return B+Math.cos(D/180*n)*R+Math.sin(D/180*n)*F}function p(B,R,F,D){var G=1e-6,U=R-B,W=F-R,q=3*U+3*(D-F)-6*W,Y=6*(W-U),K=3*U;return Math.abs(q)ce&&(J.sweepFlag=+!J.sweepFlag),J})}function W(){return function(q){var Y={};for(var K in q)Y[K]=q[K];return Y}}B.ROUND=function(q){function Y(K){return Math.round(K*q)/q}return q===void 0&&(q=1e13),a(q),function(K){return K.x1!==void 0&&(K.x1=Y(K.x1)),K.y1!==void 0&&(K.y1=Y(K.y1)),K.x2!==void 0&&(K.x2=Y(K.x2)),K.y2!==void 0&&(K.y2=Y(K.y2)),K.x!==void 0&&(K.x=Y(K.x)),K.y!==void 0&&(K.y=Y(K.y)),K.rX!==void 0&&(K.rX=Y(K.rX)),K.rY!==void 0&&(K.rY=Y(K.rY)),K}},B.TO_ABS=R,B.TO_REL=function(){return G(function(q,Y,K){return q.relative||(q.x1!==void 0&&(q.x1-=Y),q.y1!==void 0&&(q.y1-=K),q.x2!==void 0&&(q.x2-=Y),q.y2!==void 0&&(q.y2-=K),q.x!==void 0&&(q.x-=Y),q.y!==void 0&&(q.y-=K),q.relative=!0),q})},B.NORMALIZE_HVZ=function(q,Y,K){return q===void 0&&(q=!0),Y===void 0&&(Y=!0),K===void 0&&(K=!0),G(function(Z,j,Q,J,te){if(isNaN(J)&&!(Z.type&_.MOVE_TO))throw new Error("path must start with moveto");return Y&&Z.type&_.HORIZ_LINE_TO&&(Z.type=_.LINE_TO,Z.y=Z.relative?0:Q),K&&Z.type&_.VERT_LINE_TO&&(Z.type=_.LINE_TO,Z.x=Z.relative?0:j),q&&Z.type&_.CLOSE_PATH&&(Z.type=_.LINE_TO,Z.x=Z.relative?J-j:J,Z.y=Z.relative?te-Q:te),Z.type&_.ARC&&(Z.rX===0||Z.rY===0)&&(Z.type=_.LINE_TO,delete Z.rX,delete Z.rY,delete Z.xRot,delete Z.lArcFlag,delete Z.sweepFlag),Z})},B.NORMALIZE_ST=F,B.QT_TO_C=D,B.INFO=G,B.SANITIZE=function(q){q===void 0&&(q=0),a(q);var Y=NaN,K=NaN,Z=NaN,j=NaN;return G(function(Q,J,te,ne,ie){var re=Math.abs,oe=!1,le=0,fe=0;if(Q.type&_.SMOOTH_CURVE_TO&&(le=isNaN(Y)?0:J-Y,fe=isNaN(K)?0:te-K),Q.type&(_.CURVE_TO|_.SMOOTH_CURVE_TO)?(Y=Q.relative?J+Q.x2:Q.x2,K=Q.relative?te+Q.y2:Q.y2):(Y=NaN,K=NaN),Q.type&_.SMOOTH_QUAD_TO?(Z=isNaN(Z)?J:2*J-Z,j=isNaN(j)?te:2*te-j):Q.type&_.QUAD_TO?(Z=Q.relative?J+Q.x1:Q.x1,j=Q.relative?te+Q.y1:Q.y2):(Z=NaN,j=NaN),Q.type&_.LINE_COMMANDS||Q.type&_.ARC&&(Q.rX===0||Q.rY===0||!Q.lArcFlag)||Q.type&_.CURVE_TO||Q.type&_.SMOOTH_CURVE_TO||Q.type&_.QUAD_TO||Q.type&_.SMOOTH_QUAD_TO){var he=Q.x===void 0?0:Q.relative?Q.x:Q.x-J,ge=Q.y===void 0?0:Q.relative?Q.y:Q.y-te;le=isNaN(Z)?Q.x1===void 0?le:Q.relative?Q.x:Q.x1-J:Z-J,fe=isNaN(j)?Q.y1===void 0?fe:Q.relative?Q.y:Q.y1-te:j-te;var ce=Q.x2===void 0?0:Q.relative?Q.x:Q.x2-J,me=Q.y2===void 0?0:Q.relative?Q.y:Q.y2-te;re(he)<=q&&re(ge)<=q&&re(le)<=q&&re(fe)<=q&&re(ce)<=q&&re(me)<=q&&(oe=!0)}return Q.type&_.CLOSE_PATH&&re(J-ne)<=q&&re(te-ie)<=q&&(oe=!0),oe?[]:Q})},B.MATRIX=U,B.ROTATE=function(q,Y,K){Y===void 0&&(Y=0),K===void 0&&(K=0),a(q,Y,K);var Z=Math.sin(q),j=Math.cos(q);return U(j,Z,-Z,j,Y-Y*j+K*Z,K-Y*Z-K*j)},B.TRANSLATE=function(q,Y){return Y===void 0&&(Y=0),a(q,Y),U(1,0,0,1,q,Y)},B.SCALE=function(q,Y){return Y===void 0&&(Y=q),a(q,Y),U(q,0,0,Y,0,0)},B.SKEW_X=function(q){return a(q),U(1,0,Math.atan(q),1,0,0)},B.SKEW_Y=function(q){return a(q),U(1,Math.atan(q),0,1,0,0)},B.X_AXIS_SYMMETRY=function(q){return q===void 0&&(q=0),a(q),U(-1,0,0,1,q,0)},B.Y_AXIS_SYMMETRY=function(q){return q===void 0&&(q=0),a(q),U(1,0,0,-1,0,q)},B.A_TO_C=function(){return G(function(q,Y,K){return _.ARC===q.type?function(Z,j,Q){var J,te,ne,ie;Z.cX||o(Z,j,Q);for(var re=Math.min(Z.phi1,Z.phi2),oe=Math.max(Z.phi1,Z.phi2)-re,le=Math.ceil(oe/90),fe=new Array(le),he=j,ge=Q,ce=0;cej.maxX&&(j.maxX=Ce),Cej.maxY&&(j.maxY=Ce),CeIe&&ie(m$1(J,ne.x1,ne.x2,ne.x,Ie));for(var fe=0,he=p(te,ne.y1,ne.y2,ne.y);feIe&&re(m$1(te,ne.y1,ne.y2,ne.y,Ie))}if(ne.type&_.ARC){ie(ne.x),re(ne.y),o(ne,J,te);for(var ge=ne.xRot/180*Math.PI,ce=Math.cos(ge)*ne.rX,me=Math.sin(ge)*ne.rX,ye=-Math.sin(ge)*ne.rY,ve=Math.cos(ge)*ne.rY,pe=ne.phi1ne.phi2?[ne.phi2+360,ne.phi1+360]:[ne.phi2,ne.phi1],be=pe[0],xe=pe[1],ue=function(Ce){var Te=Ce[0],Se=Ce[1],Ne=180*Math.atan2(Se,Te)/Math.PI;return Nebe&&Iebe&&IeZ)throw new SyntaxError('Expected positive number, got "'+Z+'" at index "'+W+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+W+'"')}this.curArgs.push(Z),this.curArgs.length===N[this.curCommandType]&&(_.HORIZ_LINE_TO===this.curCommandType?U({type:_.HORIZ_LINE_TO,relative:this.curCommandRelative,x:Z}):_.VERT_LINE_TO===this.curCommandType?U({type:_.VERT_LINE_TO,relative:this.curCommandRelative,y:Z}):this.curCommandType===_.MOVE_TO||this.curCommandType===_.LINE_TO||this.curCommandType===_.SMOOTH_QUAD_TO?(U({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),_.MOVE_TO===this.curCommandType&&(this.curCommandType=_.LINE_TO)):this.curCommandType===_.CURVE_TO?U({type:_.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===_.SMOOTH_CURVE_TO?U({type:_.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.QUAD_TO?U({type:_.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.ARC&&U({type:_.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!T(q))if(q===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(q!=="+"&&q!=="-"&&q!==".")if(K)this.curNumber=q,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+W+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+q+'" at index '+W+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,q!=="z"&&q!=="Z")if(q==="h"||q==="H")this.curCommandType=_.HORIZ_LINE_TO,this.curCommandRelative=q==="h";else if(q==="v"||q==="V")this.curCommandType=_.VERT_LINE_TO,this.curCommandRelative=q==="v";else if(q==="m"||q==="M")this.curCommandType=_.MOVE_TO,this.curCommandRelative=q==="m";else if(q==="l"||q==="L")this.curCommandType=_.LINE_TO,this.curCommandRelative=q==="l";else if(q==="c"||q==="C")this.curCommandType=_.CURVE_TO,this.curCommandRelative=q==="c";else if(q==="s"||q==="S")this.curCommandType=_.SMOOTH_CURVE_TO,this.curCommandRelative=q==="s";else if(q==="q"||q==="Q")this.curCommandType=_.QUAD_TO,this.curCommandRelative=q==="q";else if(q==="t"||q==="T")this.curCommandType=_.SMOOTH_QUAD_TO,this.curCommandRelative=q==="t";else{if(q!=="a"&&q!=="A")throw new SyntaxError('Unexpected character "'+q+'" at index '+W+".");this.curCommandType=_.ARC,this.curCommandRelative=q==="a"}else D.push({type:_.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=q,this.curNumberHasDecimal=q==="."}else this.curNumber+=q,this.curNumberHasDecimal=!0;else this.curNumber+=q;else this.curNumber+=q,this.curNumberHasExp=!0;else this.curNumber+=q,this.curNumberHasExpDigits=this.curNumberHasExp}return D},R.prototype.transform=function(F){return Object.create(this,{parse:{value:function(D,G){G===void 0&&(G=[]);for(var U=0,W=Object.getPrototypeOf(this).parse.call(this,D);U>he;if(W[le+3]=ft,ft!==0){var lt=255/ft;W[le]=(Ce*fe>>he)*lt,W[le+1]=(Te*fe>>he)*lt,W[le+2]=(Se*fe>>he)*lt}else W[le]=W[le+1]=W[le+2]=0;Ce-=Be,Te-=Ae,Se-=Pe,Ne-=Ie,Be-=ie.r,Ae-=ie.g,Pe-=ie.b,Ie-=ie.a;var Ee=ot+U+1;Ee=oe+(Ee>he,dt>0?(dt=255/dt,W[Wt]=(xt*fe>>he)*dt,W[Wt+1]=(Nt*fe>>he)*dt,W[Wt+2]=($t*fe>>he)*dt):W[Wt]=W[Wt+1]=W[Wt+2]=0,xt-=ct,Nt-=bt,$t-=wt,ai-=st,ct-=ie.r,bt-=ie.g,wt-=ie.b,st-=ie.a,Wt=Qe+((Wt=yi+Z)0&&arguments[0]!==void 0?arguments[0]:{};const R={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:B,createCanvas(F,D){return new OffscreenCanvas(F,D)},async createImage(F){const G=await(await fetch(F)).blob();return await createImageBitmap(G)}};return(typeof globalThis.DOMParser!="undefined"||typeof B=="undefined")&&Reflect.deleteProperty(R,"DOMParser"),R}function node(B){let{DOMParser:R,canvas:F,fetch:D}=B;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:R,fetch:D,createCanvas:F.createCanvas,createImage:F.loadImage}}var index=Object.freeze({__proto__:null,offscreen,node});function compressSpaces(B){return B.replace(/(?!\u3000)\s+/gm," ")}function trimLeft(B){return B.replace(/^[\n \t]+/,"")}function trimRight(B){return B.replace(/[\n \t]+$/,"")}function toNumbers(B){const R=B.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return R?R.map(parseFloat):[]}function toMatrixValue(B){const R=toNumbers(B);return[R[0]||0,R[1]||0,R[2]||0,R[3]||0,R[4]||0,R[5]||0]}const allUppercase=/^[A-Z-]+$/;function normalizeAttributeName(B){return allUppercase.test(B)?B.toLowerCase():B}function parseExternalUrl(B){const R=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(B);return R&&(R[2]||R[3]||R[4])||""}function normalizeColor(B){if(!B.startsWith("rgb"))return B;let R=3;return B.replace(/\d+(\.\d+)?/g,(D,G)=>R--&&G?String(Math.round(parseFloat(D))):D)}const attributeRegex=/(\[[^\]]+\])/g,idRegex=/(#[^\s+>~.[:]+)/g,classRegex=/(\.[^\s+>~.[:]+)/g,pseudoElementRegex=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,pseudoClassWithBracketsRegex=/(:[\w-]+\([^)]*\))/gi,pseudoClassRegex=/(:[^\s+>~.[:]+)/g,elementRegex=/([^\s+>~.[:]+)/g;function findSelectorMatch(B,R){const F=R.exec(B);return F?[B.replace(R," "),F.length]:[B,0]}function getSelectorSpecificity(B){const R=[0,0,0];let F=B.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),D=0;return[F,D]=findSelectorMatch(F,attributeRegex),R[1]+=D,[F,D]=findSelectorMatch(F,idRegex),R[0]+=D,[F,D]=findSelectorMatch(F,classRegex),R[1]+=D,[F,D]=findSelectorMatch(F,pseudoElementRegex),R[2]+=D,[F,D]=findSelectorMatch(F,pseudoClassWithBracketsRegex),R[1]+=D,[F,D]=findSelectorMatch(F,pseudoClassRegex),R[1]+=D,F=F.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[F,D]=findSelectorMatch(F,elementRegex),R[2]+=D,R.join("")}const PSEUDO_ZERO=1e-8;function vectorMagnitude(B){return Math.sqrt(Math.pow(B[0],2)+Math.pow(B[1],2))}function vectorsRatio(B,R){return(B[0]*R[0]+B[1]*R[1])/(vectorMagnitude(B)*vectorMagnitude(R))}function vectorsAngle(B,R){return(B[0]*R[1]0&&arguments[0]!==void 0?arguments[0]:" ";const{document:F,name:D}=this;return compressSpaces(this.getString()).trim().split(R).map(G=>new Property(F,D,G))}hasValue(R){const F=this.value;return F!==null&&F!==""&&(R||F!==0)&&typeof F!="undefined"}isString(R){const{value:F}=this,D=typeof F=="string";return!D||!R?D:R.test(F)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const R=this.getString();switch(!0){case R.endsWith("px"):case/^[0-9]+$/.test(R):return!0;default:return!1}}setValue(R){return this.value=R,this}getValue(R){return typeof R=="undefined"||this.hasValue()?this.value:R}getNumber(R){if(!this.hasValue())return typeof R=="undefined"?0:parseFloat(R);const{value:F}=this;let D=parseFloat(F);return this.isString(/%$/)&&(D/=100),D}getString(R){return typeof R=="undefined"||this.hasValue()?typeof this.value=="undefined"?"":String(this.value):String(R)}getColor(R){let F=this.getString(R);return this.isNormalizedColor||(this.isNormalizedColor=!0,F=normalizeColor(F),this.value=F),F}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[D,G]=typeof R=="boolean"?[void 0,R]:[R],{viewPort:U}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(U.computeSize("x"),U.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(U.computeSize("x"),U.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*U.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*U.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&G):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*U.computeSize(D);default:{const W=this.getNumber();return F&&W<1?W*U.computeSize(D):W}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const R=this.getString(),F=/#([^)'"]+)/.exec(R),D=(F==null?void 0:F[1])||R;return this.document.definitions[D]}getFillStyleDefinition(R,F){let D=this.getDefinition();if(!D)return null;if(typeof D.createGradient=="function"&&"getBoundingBox"in R)return D.createGradient(this.document.ctx,R,F);if(typeof D.createPattern=="function"){if(D.getHrefAttribute().hasValue()){const G=D.getAttribute("patternTransform");D=D.getHrefAttribute().getDefinition(),D&&G.hasValue()&&D.getAttribute("patternTransform",!0).setValue(G.value)}if(D)return D.createPattern(this.document.ctx,R,F)}return null}getTextBaseline(){if(!this.hasValue())return null;const R=this.getString();return Property.textBaselineMapping[R]||null}addOpacity(R){let F=this.getColor();const D=F.length;let G=0;for(let U=0;U1&&arguments[1]!==void 0?arguments[1]:0;const[D=F,G=F]=toNumbers(R);return new Point(D,G)}static parseScale(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[D=F,G=D]=toNumbers(R);return new Point(D,G)}static parsePath(R){const F=toNumbers(R),D=F.length,G=[];for(let U=0;U0}runEvents(){if(!this.working)return;const{screen:R,events:F,eventElements:D}=this,{style:G}=R.ctx.canvas;let U;G&&(G.cursor=""),F.forEach((W,q)=>{let{run:Y}=W;for(U=D[q];U;)Y(U),U=U.parent}),this.events=[],this.eventElements=[]}checkPath(R,F){if(!this.working||!F)return;const{events:D,eventElements:G}=this;D.forEach((U,W)=>{let{x:q,y:Y}=U;!G[W]&&F.isPointInPath&&F.isPointInPath(q,Y)&&(G[W]=R)})}checkBoundingBox(R,F){if(!this.working||!F)return;const{events:D,eventElements:G}=this;D.forEach((U,W)=>{let{x:q,y:Y}=U;!G[W]&&F.isPointInBox(q,Y)&&(G[W]=R)})}mapXY(R,F){const{window:D,ctx:G}=this.screen,U=new Point(R,F);let W=G.canvas;for(;W;)U.x-=W.offsetLeft,U.y-=W.offsetTop,W=W.offsetParent;return D!=null&&D.scrollX&&(U.x+=D.scrollX),D!=null&&D.scrollY&&(U.y+=D.scrollY),U}onClick(R){const{x:F,y:D}=this.mapXY(R.clientX,R.clientY);this.events.push({type:"onclick",x:F,y:D,run(G){G.onClick&&G.onClick()}})}onMouseMove(R){const{x:F,y:D}=this.mapXY(R.clientX,R.clientY);this.events.push({type:"onmousemove",x:F,y:D,run(G){G.onMouseMove&&G.onMouseMove()}})}constructor(R){this.screen=R,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const defaultWindow=typeof window!="undefined"?window:null,defaultFetch$1=typeof fetch!="undefined"?fetch.bind(void 0):void 0;class Screen{wait(R){this.waits.push(R)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const R=this.waits.every(F=>F());return R&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=R,R}setDefaults(R){R.strokeStyle="rgba(0,0,0,0)",R.lineCap="butt",R.lineJoin="miter",R.miterLimit=4}setViewBox(R){let{document:F,ctx:D,aspectRatio:G,width:U,desiredWidth:W,height:q,desiredHeight:Y,minX:K=0,minY:Z=0,refX:j,refY:Q,clip:J=!1,clipX:te=0,clipY:ne=0}=R;const ie=compressSpaces(G).replace(/^defer\s/,""),[re,oe]=ie.split(" "),le=re||"xMidYMid",fe=oe||"meet",he=U/W,ge=q/Y,ce=Math.min(he,ge),me=Math.max(he,ge);let ye=W,ve=Y;fe==="meet"&&(ye*=ce,ve*=ce),fe==="slice"&&(ye*=me,ve*=me);const pe=new Property(F,"refX",j),be=new Property(F,"refY",Q),xe=pe.hasValue()&&be.hasValue();if(xe&&D.translate(-ce*pe.getPixels("x"),-ce*be.getPixels("y")),J){const ue=ce*te,_e=ce*ne;D.beginPath(),D.moveTo(ue,_e),D.lineTo(U,_e),D.lineTo(U,q),D.lineTo(ue,q),D.closePath(),D.clip()}if(!xe){const ue=fe==="meet"&&ce===ge,_e=fe==="slice"&&me===ge,Be=fe==="meet"&&ce===he,Ae=fe==="slice"&&me===he;le.startsWith("xMid")&&(ue||_e)&&D.translate(U/2-ye/2,0),le.endsWith("YMid")&&(Be||Ae)&&D.translate(0,q/2-ve/2),le.startsWith("xMax")&&(ue||_e)&&D.translate(U-ye,0),le.endsWith("YMax")&&(Be||Ae)&&D.translate(0,q-ve)}switch(!0){case le==="none":D.scale(he,ge);break;case fe==="meet":D.scale(ce,ce);break;case fe==="slice":D.scale(me,me);break}D.translate(-K,-Z)}start(R){let{enableRedraw:F=!1,ignoreMouse:D=!1,ignoreAnimation:G=!1,ignoreDimensions:U=!1,ignoreClear:W=!1,forceRedraw:q,scaleWidth:Y,scaleHeight:K,offsetX:Z,offsetY:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:Q}=this,J=1e3/Screen.FRAMERATE;if(this.frameDuration=J,this.readyPromise=new Promise(oe=>{this.resolveReady=oe}),this.isReady()&&this.render(R,U,W,Y,K,Z,j),!F)return;let te=Date.now(),ne=te,ie=0;const re=()=>{te=Date.now(),ie=te-ne,ie>=J&&(ne=te-ie%J,this.shouldUpdate(G,q)&&(this.render(R,U,W,Y,K,Z,j),Q.runEvents())),this.intervalId=requestAnimationFrame$1(re)};D||Q.start(),this.intervalId=requestAnimationFrame$1(re)}stop(){this.intervalId&&(requestAnimationFrame$1.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(R,F){if(!R){const{frameDuration:D}=this;if(this.animations.reduce((U,W)=>W.update(D)||U,!1))return!0}return!!(typeof F=="function"&&F()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(R,F,D,G,U,W,q){const{viewPort:Y,ctx:K,isFirstRender:Z}=this,j=K.canvas;Y.clear(),j.width&&j.height&&Y.setCurrent(j.width,j.height);const Q=R.getStyle("width"),J=R.getStyle("height");!F&&(Z||typeof G!="number"&&typeof U!="number")&&(Q.hasValue()&&(j.width=Q.getPixels("x"),j.style&&(j.style.width="".concat(j.width,"px"))),J.hasValue()&&(j.height=J.getPixels("y"),j.style&&(j.style.height="".concat(j.height,"px"))));let te=j.clientWidth||j.width,ne=j.clientHeight||j.height;if(F&&Q.hasValue()&&J.hasValue()&&(te=Q.getPixels("x"),ne=J.getPixels("y")),Y.setCurrent(te,ne),typeof W=="number"&&R.getAttribute("x",!0).setValue(W),typeof q=="number"&&R.getAttribute("y",!0).setValue(q),typeof G=="number"||typeof U=="number"){const ie=toNumbers(R.getAttribute("viewBox").getString());let re=0,oe=0;if(typeof G=="number"){const fe=R.getStyle("width");fe.hasValue()?re=fe.getPixels("x")/G:ie[2]&&!isNaN(ie[2])&&(re=ie[2]/G)}if(typeof U=="number"){const fe=R.getStyle("height");fe.hasValue()?oe=fe.getPixels("y")/U:ie[3]&&!isNaN(ie[3])&&(oe=ie[3]/U)}re||(re=oe),oe||(oe=re),R.getAttribute("width",!0).setValue(G),R.getAttribute("height",!0).setValue(U);const le=R.getStyle("transform",!0,!0);le.setValue("".concat(le.getString()," scale(").concat(1/re,", ").concat(1/oe,")"))}D||K.clearRect(0,0,te,ne),R.render(K),Z&&(this.isFirstRender=!1)}constructor(R,{fetch:F=defaultFetch$1,window:D=defaultWindow}={}){if(this.ctx=R,this.viewPort=new ViewPort,this.mouse=new Mouse(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=D,!F)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=F}}Screen.defaultWindow=defaultWindow;Screen.defaultFetch=defaultFetch$1;Screen.FRAMERATE=30;Screen.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch}=Screen,DefaultDOMParser=typeof DOMParser!="undefined"?DOMParser:void 0;class Parser{async parse(R){return R.startsWith("<")?this.parseFromString(R):this.load(R)}parseFromString(R){const F=new this.DOMParser;try{return this.checkDocument(F.parseFromString(R,"image/svg+xml"))}catch{return this.checkDocument(F.parseFromString(R,"text/xml"))}}checkDocument(R){const F=R.getElementsByTagName("parsererror")[0];if(F)throw new Error(F.textContent||"Unknown parse error");return R}async load(R){const D=await(await this.fetch(R)).text();return this.parseFromString(D)}constructor({fetch:R=defaultFetch,DOMParser:F=DefaultDOMParser}={}){if(!R)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!F)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=R,this.DOMParser=F}}class Translate{apply(R){const{x:F,y:D}=this.point;R.translate(F||0,D||0)}unapply(R){const{x:F,y:D}=this.point;R.translate(-1*F||0,-1*D||0)}applyToPoint(R){const{x:F,y:D}=this.point;R.applyTransform([1,0,0,1,F||0,D||0])}constructor(R,F){this.type="translate",this.point=Point.parse(F)}}class Rotate{apply(R){const{cx:F,cy:D,originX:G,originY:U,angle:W}=this,q=F+G.getPixels("x"),Y=D+U.getPixels("y");R.translate(q,Y),R.rotate(W.getRadians()),R.translate(-q,-Y)}unapply(R){const{cx:F,cy:D,originX:G,originY:U,angle:W}=this,q=F+G.getPixels("x"),Y=D+U.getPixels("y");R.translate(q,Y),R.rotate(-1*W.getRadians()),R.translate(-q,-Y)}applyToPoint(R){const{cx:F,cy:D,angle:G}=this,U=G.getRadians();R.applyTransform([1,0,0,1,F||0,D||0]),R.applyTransform([Math.cos(U),Math.sin(U),-Math.sin(U),Math.cos(U),0,0]),R.applyTransform([1,0,0,1,-F||0,-D||0])}constructor(R,F,D){this.type="rotate";const G=toNumbers(F);this.angle=new Property(R,"angle",G[0]),this.originX=D[0],this.originY=D[1],this.cx=G[1]||0,this.cy=G[2]||0}}class Scale{apply(R){const{scale:{x:F,y:D},originX:G,originY:U}=this,W=G.getPixels("x"),q=U.getPixels("y");R.translate(W,q),R.scale(F,D||F),R.translate(-W,-q)}unapply(R){const{scale:{x:F,y:D},originX:G,originY:U}=this,W=G.getPixels("x"),q=U.getPixels("y");R.translate(W,q),R.scale(1/F,1/D||F),R.translate(-W,-q)}applyToPoint(R){const{x:F,y:D}=this.scale;R.applyTransform([F||0,0,0,D||0,0,0])}constructor(R,F,D){this.type="scale";const G=Point.parseScale(F);(G.x===0||G.y===0)&&(G.x=PSEUDO_ZERO,G.y=PSEUDO_ZERO),this.scale=G,this.originX=D[0],this.originY=D[1]}}class Matrix{apply(R){const{originX:F,originY:D,matrix:G}=this,U=F.getPixels("x"),W=D.getPixels("y");R.translate(U,W),R.transform(G[0],G[1],G[2],G[3],G[4],G[5]),R.translate(-U,-W)}unapply(R){const{originX:F,originY:D,matrix:G}=this,U=G[0],W=G[2],q=G[4],Y=G[1],K=G[3],Z=G[5],j=0,Q=0,J=1,te=1/(U*(K*J-Z*Q)-W*(Y*J-Z*j)+q*(Y*Q-K*j)),ne=F.getPixels("x"),ie=D.getPixels("y");R.translate(ne,ie),R.transform(te*(K*J-Z*Q),te*(Z*j-Y*J),te*(q*Q-W*J),te*(U*J-q*j),te*(W*Z-q*K),te*(q*Y-U*Z)),R.translate(-ne,-ie)}applyToPoint(R){R.applyTransform(this.matrix)}constructor(R,F,D){this.type="matrix",this.matrix=toMatrixValue(F),this.originX=D[0],this.originY=D[1]}}class Skew extends Matrix{constructor(R,F,D){super(R,F,D),this.type="skew",this.angle=new Property(R,"angle",F)}}class SkewX extends Skew{constructor(R,F,D){super(R,F,D),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class SkewY extends Skew{constructor(R,F,D){super(R,F,D),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function parseTransforms(B){return compressSpaces(B).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function parseTransform(B){const[R="",F=""]=B.split("(");return[R.trim(),F.trim().replace(")","")]}class Transform{static fromElement(R,F){const D=F.getStyle("transform",!1,!0);if(D.hasValue()){const[G,U=G]=F.getStyle("transform-origin",!1,!0).split();if(G&&U){const W=[G,U];return new Transform(R,D.getString(),W)}}return null}apply(R){this.transforms.forEach(F=>F.apply(R))}unapply(R){this.transforms.forEach(F=>F.unapply(R))}applyToPoint(R){this.transforms.forEach(F=>F.applyToPoint(R))}constructor(R,F,D){this.document=R,this.transforms=[],parseTransforms(F).forEach(U=>{if(U==="none")return;const[W,q]=parseTransform(U),Y=Transform.transformTypes[W];Y&&this.transforms.push(new Y(this.document,q,D))})}}Transform.transformTypes={translate:Translate,rotate:Rotate,scale:Scale,matrix:Matrix,skewX:SkewX,skewY:SkewY};class Element$1{getAttribute(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const D=this.attributes[R];if(!D&&F){const G=new Property(this.document,R,"");return this.attributes[R]=G,G}return D||Property.empty(this.document)}getHrefAttribute(){let R;for(const F in this.attributes)if(F==="href"||F.endsWith(":href")){R=this.attributes[F];break}return R||Property.empty(this.document)}getStyle(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const G=this.styles[R];if(G)return G;const U=this.getAttribute(R);if(U.hasValue())return this.styles[R]=U,U;if(!D){const{parent:W}=this;if(W){const q=W.getStyle(R);if(q.hasValue())return q}}if(F){const W=new Property(this.document,R,"");return this.styles[R]=W,W}return Property.empty(this.document)}render(R){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(R.save(),this.getStyle("mask").hasValue()){const F=this.getStyle("mask").getDefinition();F&&(this.applyEffects(R),F.apply(R,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const F=this.getStyle("filter").getDefinition();F&&(this.applyEffects(R),F.apply(R,this))}else this.setContext(R),this.renderChildren(R),this.clearContext(R);R.restore()}}setContext(R){}applyEffects(R){const F=Transform.fromElement(this.document,this);F&&F.apply(R);const D=this.getStyle("clip-path",!1,!0);if(D.hasValue()){const G=D.getDefinition();G&&G.apply(R)}}clearContext(R){}renderChildren(R){this.children.forEach(F=>{F.render(R)})}addChild(R){const F=R instanceof Element$1?R:this.document.createElement(R);F.parent=this,Element$1.ignoreChildTypes.includes(F.type)||this.children.push(F)}matchesSelector(R){var F;const{node:D}=this;if(typeof D.matches=="function")return D.matches(R);const G=(F=D.getAttribute)===null||F===void 0?void 0:F.call(D,"class");return!G||G===""?!1:G.split(" ").some(U=>".".concat(U)===R)}addStylesFromStyleDefinition(){const{styles:R,stylesSpecificity:F}=this.document;let D;for(const G in R)if(!G.startsWith("@")&&this.matchesSelector(G)){const U=R[G],W=F[G];if(U)for(const q in U){let Y=this.stylesSpecificity[q];typeof Y=="undefined"&&(Y="000"),W&&W>=Y&&(D=U[q],D&&(this.styles[q]=D),this.stylesSpecificity[q]=W)}}}removeStyles(R,F){return F.reduce((G,U)=>{const W=R.getStyle(U);if(!W.hasValue())return G;const q=W.getString();return W.setValue(""),[...G,[U,q]]},[])}restoreStyles(R,F){F.forEach(D=>{let[G,U]=D;R.getStyle(G,!0).setValue(U)})}isFirstChild(){var R;return((R=this.parent)===null||R===void 0?void 0:R.children.indexOf(this))===0}constructor(R,F,D=!1){if(this.document=R,this.node=F,this.captureTextNodes=D,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!F||F.nodeType!==1)return;Array.from(F.attributes).forEach(W=>{const q=normalizeAttributeName(W.nodeName);this.attributes[q]=new Property(R,q,W.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(q=>q.trim()).forEach(q=>{if(!q)return;const[Y,K]=q.split(":").map(Z=>Z.trim());Y&&(this.styles[Y]=new Property(R,Y,K))});const{definitions:G}=R,U=this.getAttribute("id");U.hasValue()&&(G[U.getString()]||(G[U.getString()]=this)),Array.from(F.childNodes).forEach(W=>{if(W.nodeType===1)this.addChild(W);else if(D&&(W.nodeType===3||W.nodeType===4)){const q=R.createTextNode(W);q.getText().length>0&&this.addChild(q)}})}}Element$1.ignoreChildTypes=["title"];class UnknownElement extends Element$1{constructor(R,F,D){super(R,F,D)}}function wrapFontFamily(B){const R=B.trim();return/^('|")/.test(R)?R:'"'.concat(R,'"')}function prepareFontFamily(B){return typeof process=="undefined"?B:B.trim().split(",").map(wrapFontFamily).join(",")}function prepareFontStyle(B){if(!B)return"";const R=B.trim().toLowerCase();switch(R){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return R;default:return/^oblique\s+(-|)\d+deg$/.test(R)?R:""}}function prepareFontWeight(B){if(!B)return"";const R=B.trim().toLowerCase();switch(R){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return R;default:return/^[\d.]+$/.test(R)?R:""}}class Font{static parse(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",F=arguments.length>1?arguments[1]:void 0,D="",G="",U="",W="",q="";const Y=compressSpaces(R).trim().split(" "),K={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return Y.forEach(Z=>{switch(!0){case(!K.fontStyle&&Font.styles.includes(Z)):Z!=="inherit"&&(D=Z),K.fontStyle=!0;break;case(!K.fontVariant&&Font.variants.includes(Z)):Z!=="inherit"&&(G=Z),K.fontStyle=!0,K.fontVariant=!0;break;case(!K.fontWeight&&Font.weights.includes(Z)):Z!=="inherit"&&(U=Z),K.fontStyle=!0,K.fontVariant=!0,K.fontWeight=!0;break;case!K.fontSize:Z!=="inherit"&&(W=Z.split("/")[0]||""),K.fontStyle=!0,K.fontVariant=!0,K.fontWeight=!0,K.fontSize=!0;break;default:Z!=="inherit"&&(q+=Z)}}),new Font(D,G,U,W,q,F)}toString(){return[prepareFontStyle(this.fontStyle),this.fontVariant,prepareFontWeight(this.fontWeight),this.fontSize,prepareFontFamily(this.fontFamily)].join(" ").trim()}constructor(R,F,D,G,U,W){const q=W?typeof W=="string"?Font.parse(W):W:{};this.fontFamily=U||q.fontFamily,this.fontSize=G||q.fontSize,this.fontStyle=R||q.fontStyle,this.fontWeight=D||q.fontWeight,this.fontVariant=F||q.fontVariant}}Font.styles="normal|italic|oblique|inherit";Font.variants="normal|small-caps|inherit";Font.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class BoundingBox{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(R,F){typeof R!="undefined"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=R,this.x2=R),Rthis.x2&&(this.x2=R)),typeof F!="undefined"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=F,this.y2=F),Fthis.y2&&(this.y2=F))}addX(R){this.addPoint(R,0)}addY(R){this.addPoint(0,R)}addBoundingBox(R){if(!R)return;const{x1:F,y1:D,x2:G,y2:U}=R;this.addPoint(F,D),this.addPoint(G,U)}sumCubic(R,F,D,G,U){return Math.pow(1-R,3)*F+3*Math.pow(1-R,2)*R*D+3*(1-R)*Math.pow(R,2)*G+Math.pow(R,3)*U}bezierCurveAdd(R,F,D,G,U){const W=6*F-12*D+6*G,q=-3*F+9*D-9*G+3*U,Y=3*D-3*F;if(q===0){if(W===0)return;const Q=-Y/W;01&&arguments[1]!==void 0?arguments[1]:!1;if(!F){const D=this.getStyle("fill"),G=this.getStyle("fill-opacity"),U=this.getStyle("stroke"),W=this.getStyle("stroke-opacity");if(D.isUrlDefinition()){const J=D.getFillStyleDefinition(this,G);J&&(R.fillStyle=J)}else if(D.hasValue()){D.getString()==="currentColor"&&D.setValue(this.getStyle("color").getColor());const J=D.getColor();J!=="inherit"&&(R.fillStyle=J==="none"?"rgba(0,0,0,0)":J)}if(G.hasValue()){const J=new Property(this.document,"fill",R.fillStyle).addOpacity(G).getColor();R.fillStyle=J}if(U.isUrlDefinition()){const J=U.getFillStyleDefinition(this,W);J&&(R.strokeStyle=J)}else if(U.hasValue()){U.getString()==="currentColor"&&U.setValue(this.getStyle("color").getColor());const J=U.getString();J!=="inherit"&&(R.strokeStyle=J==="none"?"rgba(0,0,0,0)":J)}if(W.hasValue()){const J=new Property(this.document,"stroke",R.strokeStyle).addOpacity(W).getString();R.strokeStyle=J}const q=this.getStyle("stroke-width");if(q.hasValue()){const J=q.getPixels();R.lineWidth=J||PSEUDO_ZERO}const Y=this.getStyle("stroke-linecap"),K=this.getStyle("stroke-linejoin"),Z=this.getStyle("stroke-miterlimit"),j=this.getStyle("stroke-dasharray"),Q=this.getStyle("stroke-dashoffset");if(Y.hasValue()&&(R.lineCap=Y.getString()),K.hasValue()&&(R.lineJoin=K.getString()),Z.hasValue()&&(R.miterLimit=Z.getNumber()),j.hasValue()&&j.getString()!=="none"){const J=toNumbers(j.getString());typeof R.setLineDash!="undefined"?R.setLineDash(J):typeof R.webkitLineDash!="undefined"?R.webkitLineDash=J:typeof R.mozDash!="undefined"&&!(J.length===1&&J[0]===0)&&(R.mozDash=J);const te=Q.getPixels();typeof R.lineDashOffset!="undefined"?R.lineDashOffset=te:typeof R.webkitLineDashOffset!="undefined"?R.webkitLineDashOffset=te:typeof R.mozDashOffset!="undefined"&&(R.mozDashOffset=te)}}if(this.modifiedEmSizeStack=!1,typeof R.font!="undefined"){const D=this.getStyle("font"),G=this.getStyle("font-style"),U=this.getStyle("font-variant"),W=this.getStyle("font-weight"),q=this.getStyle("font-size"),Y=this.getStyle("font-family"),K=new Font(G.getString(),U.getString(),W.getString(),q.hasValue()?"".concat(q.getPixels(!0),"px"):"",Y.getString(),Font.parse(D.getString(),R.font));G.setValue(K.fontStyle),U.setValue(K.fontVariant),W.setValue(K.fontWeight),q.setValue(K.fontSize),Y.setValue(K.fontFamily),R.font=K.toString(),q.isPixels()&&(this.document.emSize=q.getPixels(),this.modifiedEmSizeStack=!0)}F||(this.applyEffects(R),R.globalAlpha=this.calculateOpacity())}clearContext(R){super.clearContext(R),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...R){super(...R),this.modifiedEmSizeStack=!1}}class TextElement extends RenderedElement{setContext(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(R,F);const D=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();D&&(R.textBaseline=D)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(R){if(this.type!=="text")return this.getTElementBoundingBox(R);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(R);let F=null;return this.children.forEach((D,G)=>{const U=this.getChildBoundingBox(R,this,this,G);F?F.addBoundingBox(U):F=U}),F}getFontSize(){const{document:R,parent:F}=this,D=Font.parse(R.ctx.font).fontSize;return F.getStyle("font-size").getNumber(D)}getTElementBoundingBox(R){const F=this.getFontSize();return new BoundingBox(this.x,this.y-F,this.x+this.measureText(R),this.y)}getGlyph(R,F,D){const G=F[D];let U;if(R.isArabic){var W;const q=F.length,Y=F[D-1],K=F[D+1];let Z="isolated";(D===0||Y===" ")&&D0&&Y!==" "&&D0&&Y!==" "&&(D===q-1||K===" ")&&(Z="initial"),U=((W=R.arabicGlyphs[G])===null||W===void 0?void 0:W[Z])||R.glyphs[G]}else U=R.glyphs[G];return U||(U=R.missingGlyph),U}getText(){return""}getTextFromNode(R){const F=R||this.node,D=Array.from(F.parentNode.childNodes),G=D.indexOf(F),U=D.length-1;let W=compressSpaces(F.textContent||"");return G===0&&(W=trimLeft(W)),G===U&&(W=trimRight(W)),W}renderChildren(R){if(this.type!=="text"){this.renderTElementChildren(R);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(R),this.children.forEach((D,G)=>{this.renderChild(R,this,this,G)});const{mouse:F}=this.document.screen;F.isWorking()&&F.checkBoundingBox(this,this.getBoundingBox(R))}renderTElementChildren(R){const{document:F,parent:D}=this,G=this.getText(),U=D.getStyle("font-family").getDefinition();if(U){const{unitsPerEm:Y}=U.fontFace,K=Font.parse(F.ctx.font),Z=D.getStyle("font-size").getNumber(K.fontSize),j=D.getStyle("font-style").getString(K.fontStyle),Q=Z/Y,J=U.isRTL?G.split("").reverse().join(""):G,te=toNumbers(D.getAttribute("dx").getString()),ne=J.length;for(let ie=0;ie=this.leafTexts.length)return;const R=this.leafTexts[this.textChunkStart],F=R.getStyle("text-anchor").getString("start"),D=!1;let G=0;F==="start"&&!D||F==="end"&&D?G=R.x-this.minX:F==="end"&&!D||F==="start"&&D?G=R.x-this.maxX:G=R.x-(this.minX+this.maxX)/2;for(let U=this.textChunkStart;U{this.adjustChildCoordinatesRecursiveCore(R,this,this,D)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(R,F,D,G){const U=D.children[G];U.children.length>0?U.children.forEach((W,q)=>{F.adjustChildCoordinatesRecursiveCore(R,F,U,q)}):this.adjustChildCoordinates(R,F,D,G)}adjustChildCoordinates(R,F,D,G){const U=D.children[G];if(typeof U.measureText!="function")return U;R.save(),U.setContext(R,!0);const W=U.getAttribute("x"),q=U.getAttribute("y"),Y=U.getAttribute("dx"),K=U.getAttribute("dy"),Z=U.getStyle("font-family").getDefinition(),j=Boolean(Z==null?void 0:Z.isRTL);G===0&&(W.hasValue()||W.setValue(U.getInheritedAttribute("x")),q.hasValue()||q.setValue(U.getInheritedAttribute("y")),Y.hasValue()||Y.setValue(U.getInheritedAttribute("dx")),K.hasValue()||K.setValue(U.getInheritedAttribute("dy")));const Q=U.measureText(R);return j&&(F.x-=Q),W.hasValue()?(F.applyAnchoring(),U.x=W.getPixels("x"),Y.hasValue()&&(U.x+=Y.getPixels("x"))):(Y.hasValue()&&(F.x+=Y.getPixels("x")),U.x=F.x),F.x=U.x,j||(F.x+=Q),q.hasValue()?(U.y=q.getPixels("y"),K.hasValue()&&(U.y+=K.getPixels("y"))):(K.hasValue()&&(F.y+=K.getPixels("y")),U.y=F.y),F.y=U.y,F.leafTexts.push(U),F.minX=Math.min(F.minX,U.x,U.x+Q),F.maxX=Math.max(F.maxX,U.x,U.x+Q),U.clearContext(R),R.restore(),U}getChildBoundingBox(R,F,D,G){const U=D.children[G];if(typeof U.getBoundingBox!="function")return null;const W=U.getBoundingBox(R);return W&&U.children.forEach((q,Y)=>{const K=F.getChildBoundingBox(R,F,U,Y);W.addBoundingBox(K)}),W}renderChild(R,F,D,G){const U=D.children[G];U.render(R),U.children.forEach((W,q)=>{F.renderChild(R,F,U,q)})}measureText(R){const{measureCache:F}=this;if(~F)return F;const D=this.getText(),G=this.measureTargetText(R,D);return this.measureCache=G,G}measureTargetText(R,F){if(!F.length)return 0;const{parent:D}=this,G=D.getStyle("font-family").getDefinition();if(G){const W=this.getFontSize(),q=G.isRTL?F.split("").reverse().join(""):F,Y=toNumbers(D.getAttribute("dx").getString()),K=q.length;let Z=0;for(let j=0;j0?"":this.getTextFromNode()}}class TextNode extends TSpanElement{constructor(...R){super(...R),this.type="textNode"}}class PathParser extends _{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Point(0,0),this.control=new Point(0,0),this.current=new Point(0,0),this.points=[],this.angles=[]}isEnd(){const{i:R,commands:F}=this;return R>=F.length-1}next(){const R=this.commands[++this.i];return this.previousCommand=this.command,this.command=R,R}getPoint(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const D=new Point(this.command[R],this.command[F]);return this.makeAbsolute(D)}getAsControlPoint(R,F){const D=this.getPoint(R,F);return this.control=D,D}getAsCurrentPoint(R,F){const D=this.getPoint(R,F);return this.current=D,D}getReflectedControlPoint(){const R=this.previousCommand.type;if(R!==_.CURVE_TO&&R!==_.SMOOTH_CURVE_TO&&R!==_.QUAD_TO&&R!==_.SMOOTH_QUAD_TO)return this.current;const{current:{x:F,y:D},control:{x:G,y:U}}=this;return new Point(2*F-G,2*D-U)}makeAbsolute(R){if(this.command.relative){const{x:F,y:D}=this.current;R.x+=F,R.y+=D}return R}addMarker(R,F,D){const{points:G,angles:U}=this;D&&U.length>0&&!U[U.length-1]&&(U[U.length-1]=G[G.length-1].angleTo(D)),this.addMarkerAngle(R,F?F.angleTo(R):null)}addMarkerAngle(R,F){this.points.push(R),this.angles.push(F)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:R}=this,F=R.length;for(let D=0;D[U,D[W]])}renderChildren(R){this.path(R),this.document.screen.mouse.checkPath(this,R);const F=this.getStyle("fill-rule");R.fillStyle!==""&&(F.getString("inherit")!=="inherit"?R.fill(F.getString()):R.fill()),R.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(R.save(),R.setTransform(1,0,0,1,0,0),R.stroke(),R.restore()):R.stroke());const D=this.getMarkers();if(D){const G=D.length-1,U=this.getStyle("marker-start"),W=this.getStyle("marker-mid"),q=this.getStyle("marker-end");if(U.isUrlDefinition()){const Y=U.getDefinition(),[K,Z]=D[0];Y.render(R,K,Z)}if(W.isUrlDefinition()){const Y=W.getDefinition();for(let K=1;K1&&(G*=Math.sqrt(Q),U*=Math.sqrt(Q));let J=(q===Y?-1:1)*Math.sqrt((Math.pow(G,2)*Math.pow(U,2)-Math.pow(G,2)*Math.pow(j.y,2)-Math.pow(U,2)*Math.pow(j.x,2))/(Math.pow(G,2)*Math.pow(j.y,2)+Math.pow(U,2)*Math.pow(j.x,2)));isNaN(J)&&(J=0);const te=new Point(J*G*j.y/U,J*-U*j.x/G),ne=new Point((F.x+Z.x)/2+Math.cos(K)*te.x-Math.sin(K)*te.y,(F.y+Z.y)/2+Math.sin(K)*te.x+Math.cos(K)*te.y),ie=vectorsAngle([1,0],[(j.x-te.x)/G,(j.y-te.y)/U]),re=[(j.x-te.x)/G,(j.y-te.y)/U],oe=[(-j.x-te.x)/G,(-j.y-te.y)/U];let le=vectorsAngle(re,oe);return vectorsRatio(re,oe)<=-1&&(le=Math.PI),vectorsRatio(re,oe)>=1&&(le=0),{currentPoint:Z,rX:G,rY:U,sweepFlag:Y,xAxisRotation:K,centp:ne,a1:ie,ad:le}}pathA(R,F){const{pathParser:D}=this,{currentPoint:G,rX:U,rY:W,sweepFlag:q,xAxisRotation:Y,centp:K,a1:Z,ad:j}=PathElement.pathA(D),Q=1-q?1:-1,J=Z+Q*(j/2),te=new Point(K.x+U*Math.cos(J),K.y+W*Math.sin(J));if(D.addMarkerAngle(te,J-Q*Math.PI/2),D.addMarkerAngle(G,J-Q*Math.PI),F.addPoint(G.x,G.y),R&&!isNaN(Z)&&!isNaN(j)){const ne=U>W?U:W,ie=U>W?1:U/W,re=U>W?W/U:1;R.translate(K.x,K.y),R.rotate(Y),R.scale(ie,re),R.arc(0,0,ne,Z,Z+j,Boolean(1-q)),R.scale(1/ie,1/re),R.rotate(-Y),R.translate(-K.x,-K.y)}}static pathZ(R){R.current=R.start}pathZ(R,F){PathElement.pathZ(this.pathParser),R&&F.x1!==F.x2&&F.y1!==F.y2&&R.closePath()}constructor(R,F,D){super(R,F,D),this.type="path",this.pathParser=new PathParser(this.getAttribute("d").getString())}}class SVGElement extends RenderedElement{setContext(R){var F;const{document:D}=this,{screen:G,window:U}=D,W=R.canvas;if(G.setDefaults(R),"style"in W&&typeof R.font!="undefined"&&U&&typeof U.getComputedStyle!="undefined"){R.font=U.getComputedStyle(W).getPropertyValue("font");const oe=new Property(D,"fontSize",Font.parse(R.font).fontSize);oe.hasValue()&&(D.rootEmSize=oe.getPixels("y"),D.emSize=D.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:q,height:Y}=G.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const K=this.getAttribute("refX"),Z=this.getAttribute("refY"),j=this.getAttribute("viewBox"),Q=j.hasValue()?toNumbers(j.getString()):null,J=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let te=0,ne=0,ie=0,re=0;Q&&(te=Q[0],ne=Q[1]),this.root||(q=this.getStyle("width").getPixels("x"),Y=this.getStyle("height").getPixels("y"),this.type==="marker"&&(ie=te,re=ne,te=0,ne=0)),G.viewPort.setCurrent(q,Y),this.node&&(!this.parent||((F=this.node.parentNode)===null||F===void 0?void 0:F.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(R),R.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),Q&&(q=Q[2],Y=Q[3]),D.setViewBox({ctx:R,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:G.viewPort.width,desiredWidth:q,height:G.viewPort.height,desiredHeight:Y,minX:te,minY:ne,refX:K.getValue(),refY:Z.getValue(),clip:J,clipX:ie,clipY:re}),Q&&(G.viewPort.removeCurrent(),G.viewPort.setCurrent(q,Y))}clearContext(R){super.clearContext(R),this.document.screen.viewPort.removeCurrent()}resize(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:R,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const G=this.getAttribute("width",!0),U=this.getAttribute("height",!0),W=this.getAttribute("viewBox"),q=this.getAttribute("style"),Y=G.getNumber(0),K=U.getNumber(0);if(D)if(typeof D=="string")this.getAttribute("preserveAspectRatio",!0).setValue(D);else{const Z=this.getAttribute("preserveAspectRatio");Z.hasValue()&&Z.setValue(Z.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(G.setValue(R),U.setValue(F),W.hasValue()||W.setValue("0 0 ".concat(Y||R," ").concat(K||F)),q.hasValue()){const Z=this.getStyle("width"),j=this.getStyle("height");Z.hasValue()&&Z.setValue("".concat(R,"px")),j.hasValue()&&j.setValue("".concat(F,"px"))}}constructor(...R){super(...R),this.type="svg",this.root=!1}}class RectElement extends PathElement{path(R){const F=this.getAttribute("x").getPixels("x"),D=this.getAttribute("y").getPixels("y"),G=this.getStyle("width",!1,!0).getPixels("x"),U=this.getStyle("height",!1,!0).getPixels("y"),W=this.getAttribute("rx"),q=this.getAttribute("ry");let Y=W.getPixels("x"),K=q.getPixels("y");if(W.hasValue()&&!q.hasValue()&&(K=Y),q.hasValue()&&!W.hasValue()&&(Y=K),Y=Math.min(Y,G/2),K=Math.min(K,U/2),R){const Z=4*((Math.sqrt(2)-1)/3);R.beginPath(),U>0&&G>0&&(R.moveTo(F+Y,D),R.lineTo(F+G-Y,D),R.bezierCurveTo(F+G-Y+Z*Y,D,F+G,D+K-Z*K,F+G,D+K),R.lineTo(F+G,D+U-K),R.bezierCurveTo(F+G,D+U-K+Z*K,F+G-Y+Z*Y,D+U,F+G-Y,D+U),R.lineTo(F+Y,D+U),R.bezierCurveTo(F+Y-Z*Y,D+U,F,D+U-K+Z*K,F,D+U-K),R.lineTo(F,D+K),R.bezierCurveTo(F,D+K-Z*K,F+Y-Z*Y,D,F+Y,D),R.closePath())}return new BoundingBox(F,D,F+G,D+U)}getMarkers(){return null}constructor(...R){super(...R),this.type="rect"}}class CircleElement extends PathElement{path(R){const F=this.getAttribute("cx").getPixels("x"),D=this.getAttribute("cy").getPixels("y"),G=this.getAttribute("r").getPixels();return R&&G>0&&(R.beginPath(),R.arc(F,D,G,0,Math.PI*2,!1),R.closePath()),new BoundingBox(F-G,D-G,F+G,D+G)}getMarkers(){return null}constructor(...R){super(...R),this.type="circle"}}class EllipseElement extends PathElement{path(R){const F=4*((Math.sqrt(2)-1)/3),D=this.getAttribute("rx").getPixels("x"),G=this.getAttribute("ry").getPixels("y"),U=this.getAttribute("cx").getPixels("x"),W=this.getAttribute("cy").getPixels("y");return R&&D>0&&G>0&&(R.beginPath(),R.moveTo(U+D,W),R.bezierCurveTo(U+D,W+F*G,U+F*D,W+G,U,W+G),R.bezierCurveTo(U-F*D,W+G,U-D,W+F*G,U-D,W),R.bezierCurveTo(U-D,W-F*G,U-F*D,W-G,U,W-G),R.bezierCurveTo(U+F*D,W-G,U+D,W-F*G,U+D,W),R.closePath()),new BoundingBox(U-D,W-G,U+D,W+G)}getMarkers(){return null}constructor(...R){super(...R),this.type="ellipse"}}class LineElement extends PathElement{getPoints(){return[new Point(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Point(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(R){const[{x:F,y:D},{x:G,y:U}]=this.getPoints();return R&&(R.beginPath(),R.moveTo(F,D),R.lineTo(G,U)),new BoundingBox(F,D,G,U)}getMarkers(){const[R,F]=this.getPoints(),D=R.angleTo(F);return[[R,D],[F,D]]}constructor(...R){super(...R),this.type="line"}}class PolylineElement extends PathElement{path(R){const{points:F}=this,[{x:D,y:G}]=F,U=new BoundingBox(D,G);return R&&(R.beginPath(),R.moveTo(D,G)),F.forEach(W=>{let{x:q,y:Y}=W;U.addPoint(q,Y),R&&R.lineTo(q,Y)}),U}getMarkers(){const{points:R}=this,F=R.length-1,D=[];return R.forEach((G,U)=>{U!==F&&D.push([G,G.angleTo(R[U+1])])}),D.length>0&&D.push([R[R.length-1],D[D.length-1][1]]),D}constructor(R,F,D){super(R,F,D),this.type="polyline",this.points=[],this.points=Point.parsePath(this.getAttribute("points").getString())}}class PolygonElement extends PolylineElement{path(R){const F=super.path(R),[{x:D,y:G}]=this.points;return R&&(R.lineTo(D,G),R.closePath()),F}constructor(...R){super(...R),this.type="polygon"}}class PatternElement extends Element$1{createPattern(R,F,D){const G=this.getStyle("width").getPixels("x",!0),U=this.getStyle("height").getPixels("y",!0),W=new SVGElement(this.document,null);W.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),W.attributes.width=new Property(this.document,"width","".concat(G,"px")),W.attributes.height=new Property(this.document,"height","".concat(U,"px")),W.attributes.transform=new Property(this.document,"transform",this.getAttribute("patternTransform").getValue()),W.children=this.children;const q=this.document.createCanvas(G,U),Y=q.getContext("2d"),K=this.getAttribute("x"),Z=this.getAttribute("y");K.hasValue()&&Z.hasValue()&&Y.translate(K.getPixels("x",!0),Z.getPixels("y",!0)),D.hasValue()?this.styles["fill-opacity"]=D:Reflect.deleteProperty(this.styles,"fill-opacity");for(let Q=-1;Q<=1;Q++)for(let J=-1;J<=1;J++)Y.save(),W.attributes.x=new Property(this.document,"x",Q*q.width),W.attributes.y=new Property(this.document,"y",J*q.height),W.render(Y),Y.restore();return R.createPattern(q,"repeat")}constructor(...R){super(...R),this.type="pattern"}}class MarkerElement extends Element$1{render(R,F,D){if(!F)return;const{x:G,y:U}=F,W=this.getAttribute("orient").getString("auto"),q=this.getAttribute("markerUnits").getString("strokeWidth");R.translate(G,U),W==="auto"&&R.rotate(D),q==="strokeWidth"&&R.scale(R.lineWidth,R.lineWidth),R.save();const Y=new SVGElement(this.document);Y.type=this.type,Y.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),Y.attributes.refX=new Property(this.document,"refX",this.getAttribute("refX").getValue()),Y.attributes.refY=new Property(this.document,"refY",this.getAttribute("refY").getValue()),Y.attributes.width=new Property(this.document,"width",this.getAttribute("markerWidth").getValue()),Y.attributes.height=new Property(this.document,"height",this.getAttribute("markerHeight").getValue()),Y.attributes.overflow=new Property(this.document,"overflow",this.getAttribute("overflow").getValue()),Y.attributes.fill=new Property(this.document,"fill",this.getAttribute("fill").getColor("black")),Y.attributes.stroke=new Property(this.document,"stroke",this.getAttribute("stroke").getValue("none")),Y.children=this.children,Y.render(R),R.restore(),q==="strokeWidth"&&R.scale(1/R.lineWidth,1/R.lineWidth),W==="auto"&&R.rotate(-D),R.translate(-G,-U)}constructor(...R){super(...R),this.type="marker"}}class DefsElement extends Element$1{render(){}constructor(...R){super(...R),this.type="defs"}}class GElement extends RenderedElement{getBoundingBox(R){const F=new BoundingBox;return this.children.forEach(D=>{F.addBoundingBox(D.getBoundingBox(R))}),F}constructor(...R){super(...R),this.type="g"}}class GradientElement extends Element$1{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(R,F,D){let G=this;this.getHrefAttribute().hasValue()&&(G=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(G));const{stops:U}=G,W=this.getGradient(R,F);if(!W)return this.addParentOpacity(D,U[U.length-1].color);if(U.forEach(q=>{W.addColorStop(q.offset,this.addParentOpacity(D,q.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:q}=this,{MAX_VIRTUAL_PIXELS:Y}=Screen,{viewPort:K}=q.screen,Z=K.getRoot(),j=new RectElement(q);j.attributes.x=new Property(q,"x",-Y/3),j.attributes.y=new Property(q,"y",-Y/3),j.attributes.width=new Property(q,"width",Y),j.attributes.height=new Property(q,"height",Y);const Q=new GElement(q);Q.attributes.transform=new Property(q,"transform",this.getAttribute("gradientTransform").getValue()),Q.children=[j];const J=new SVGElement(q);J.attributes.x=new Property(q,"x",0),J.attributes.y=new Property(q,"y",0),J.attributes.width=new Property(q,"width",Z.width),J.attributes.height=new Property(q,"height",Z.height),J.children=[Q];const te=q.createCanvas(Z.width,Z.height),ne=te.getContext("2d");return ne.fillStyle=W,J.render(ne),ne.createPattern(te,"no-repeat")}return W}inheritStopContainer(R){this.attributesToInherit.forEach(F=>{!this.getAttribute(F).hasValue()&&R.getAttribute(F).hasValue()&&this.getAttribute(F,!0).setValue(R.getAttribute(F).getValue())})}addParentOpacity(R,F){return R.hasValue()?new Property(this.document,"color",F).addOpacity(R).getColor():F}constructor(R,F,D){super(R,F,D),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:G,children:U}=this;U.forEach(W=>{W.type==="stop"&&G.push(W)})}}class LinearGradientElement extends GradientElement{getGradient(R,F){const D=this.getGradientUnits()==="objectBoundingBox",G=D?F.getBoundingBox(R):null;if(D&&!G)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const U=D?G.x+G.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),W=D?G.y+G.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),q=D?G.x+G.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),Y=D?G.y+G.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return U===q&&W===Y?null:R.createLinearGradient(U,W,q,Y)}constructor(R,F,D){super(R,F,D),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class RadialGradientElement extends GradientElement{getGradient(R,F){const D=this.getGradientUnits()==="objectBoundingBox",G=F.getBoundingBox(R);if(D&&!G)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const U=D?G.x+G.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),W=D?G.y+G.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let q=U,Y=W;this.getAttribute("fx").hasValue()&&(q=D?G.x+G.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(Y=D?G.y+G.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const K=D?(G.width+G.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),Z=this.getAttribute("fr").getPixels();return R.createRadialGradient(q,Y,Z,U,W,K)}constructor(R,F,D){super(R,F,D),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class StopElement extends Element$1{constructor(R,F,D){super(R,F,D),this.type="stop";const G=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),U=this.getStyle("stop-opacity");let W=this.getStyle("stop-color",!0);W.getString()===""&&W.setValue("#000"),U.hasValue()&&(W=W.addOpacity(U)),this.offset=G,this.color=W.getColor()}}class AnimateElement extends Element$1{getProperty(){const R=this.getAttribute("attributeType").getString(),F=this.getAttribute("attributeName").getString();return R==="CSS"?this.parent.getStyle(F,!0):this.parent.getAttribute(F,!0)}calcValue(){const{initialUnits:R}=this,{progress:F,from:D,to:G}=this.getProgress();let U=D.getNumber()+(G.getNumber()-D.getNumber())*F;return R==="%"&&(U*=100),"".concat(U).concat(R)}update(R){const{parent:F}=this,D=this.getProperty();if(this.initialValue||(this.initialValue=D.getString(),this.initialUnits=D.getUnits()),this.duration>this.maxDuration){const U=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(U==="freeze"&&!this.frozen)this.frozen=!0,F&&D&&(F.animationFrozen=!0,F.animationFrozenValue=D.getString());else if(U==="remove"&&!this.removed)return this.removed=!0,F&&D&&D.setValue(F.animationFrozen?F.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=R;let G=!1;if(this.begin{const K=U[Y];return q+(K-q)*R}).join(" ")}constructor(...R){super(...R),this.type="animateTransform"}}class FontFaceElement extends Element$1{constructor(R,F,D){super(R,F,D),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class GlyphElement extends PathElement{constructor(R,F,D){super(R,F,D),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class MissingGlyphElement extends GlyphElement{constructor(...R){super(...R),this.type="missing-glyph",this.horizAdvX=0}}class FontElement extends Element$1{render(){}constructor(R,F,D){super(R,F,D),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:G}=R,{children:U}=this;for(const W of U)if(W instanceof FontFaceElement){this.fontFace=W;const q=W.getStyle("font-family");q.hasValue()&&(G[q.getString()]=this)}else if(W instanceof MissingGlyphElement)this.missingGlyph=W;else if(W instanceof GlyphElement)if(W.arabicForm){this.isRTL=!0,this.isArabic=!0;const q=this.arabicGlyphs[W.unicode];typeof q=="undefined"?this.arabicGlyphs[W.unicode]={[W.arabicForm]:W}:q[W.arabicForm]=W}else this.glyphs[W.unicode]=W}}class TRefElement extends TextElement{getText(){const R=this.getHrefAttribute().getDefinition();if(R){const F=R.children[0];if(F)return F.getText()}return""}constructor(...R){super(...R),this.type="tref"}}class AElement extends TextElement{getText(){return this.text}renderChildren(R){if(this.hasText){super.renderChildren(R);const{document:F,x:D,y:G}=this,{mouse:U}=F.screen,W=new Property(F,"fontSize",Font.parse(F.ctx.font).fontSize);U.isWorking()&&U.checkBoundingBox(this,new BoundingBox(D,G-W.getPixels("y"),D+this.measureText(R),G))}else if(this.children.length>0){const F=new GElement(this.document);F.children=this.children,F.parent=this,F.render(R)}}onClick(){const{window:R}=this.document;R&&R.open(this.getHrefAttribute().getString())}onMouseMove(){const R=this.document.ctx;R.canvas.style.cursor="pointer"}constructor(R,F,D){super(R,F,D),this.type="a";const{childNodes:G}=F,U=G[0],W=G.length>0&&Array.from(G).every(q=>q.nodeType===3);this.hasText=W,this.text=W?this.getTextFromNode(U):""}}class TextPathElement extends TextElement{getText(){return this.text}path(R){const{dataArray:F}=this;R&&R.beginPath(),F.forEach(D=>{let{type:G,points:U}=D;switch(G){case PathParser.LINE_TO:R&&R.lineTo(U[0],U[1]);break;case PathParser.MOVE_TO:R&&R.moveTo(U[0],U[1]);break;case PathParser.CURVE_TO:R&&R.bezierCurveTo(U[0],U[1],U[2],U[3],U[4],U[5]);break;case PathParser.QUAD_TO:R&&R.quadraticCurveTo(U[0],U[1],U[2],U[3]);break;case PathParser.ARC:{const[W,q,Y,K,Z,j,Q,J]=U,te=Y>K?Y:K,ne=Y>K?1:Y/K,ie=Y>K?K/Y:1;R&&(R.translate(W,q),R.rotate(Q),R.scale(ne,ie),R.arc(0,0,te,Z,Z+j,Boolean(1-J)),R.scale(1/ne,1/ie),R.rotate(-Q),R.translate(-W,-q));break}case PathParser.CLOSE_PATH:R&&R.closePath();break}})}renderChildren(R){this.setTextData(R),R.save();const F=this.parent.getStyle("text-decoration").getString(),D=this.getFontSize(),{glyphInfo:G}=this,U=R.fillStyle;F==="underline"&&R.beginPath(),G.forEach((W,q)=>{const{p0:Y,p1:K,rotation:Z,text:j}=W;R.save(),R.translate(Y.x,Y.y),R.rotate(Z),R.fillStyle&&R.fillText(j,0,0),R.strokeStyle&&R.strokeText(j,0,0),R.restore(),F==="underline"&&(q===0&&R.moveTo(Y.x,Y.y+D/8),R.lineTo(K.x,K.y+D/5))}),F==="underline"&&(R.lineWidth=D/20,R.strokeStyle=U,R.stroke(),R.closePath()),R.restore()}getLetterSpacingAt(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[R]||0}findSegmentToFitChar(R,F,D,G,U,W,q,Y,K){let Z=W,j=this.measureText(R,Y);Y===" "&&F==="justify"&&D-1&&(Z+=this.getLetterSpacingAt(K));const Q=this.textHeight/20,J=this.getEquidistantPointOnPath(Z,Q,0),te=this.getEquidistantPointOnPath(Z+j,Q,0),ne={p0:J,p1:te},ie=J&&te?Math.atan2(te.y-J.y,te.x-J.x):0;if(q){const re=Math.cos(Math.PI/2+ie)*q,oe=Math.cos(-ie)*q;ne.p0={...J,x:J.x+re,y:J.y+oe},ne.p1={...te,x:te.x+re,y:te.y+oe}}return Z+=j,{offset:Z,segment:ne,rotation:ie}}measureText(R,F){const{measuresCache:D}=this,G=F||this.getText();if(D.has(G))return D.get(G);const U=this.measureTargetText(R,G);return D.set(G,U),U}setTextData(R){if(this.glyphInfo)return;const F=this.getText(),D=F.split(""),G=F.split(" ").length-1,U=this.parent.getAttribute("dx").split().map(le=>le.getPixels("x")),W=this.parent.getAttribute("dy").getPixels("y"),q=this.parent.getStyle("text-anchor").getString("start"),Y=this.getStyle("letter-spacing"),K=this.parent.getStyle("letter-spacing");let Z=0;!Y.hasValue()||Y.getValue()==="inherit"?Z=K.getPixels():Y.hasValue()&&Y.getValue()!=="initial"&&Y.getValue()!=="unset"&&(Z=Y.getPixels());const j=[],Q=F.length;this.letterSpacingCache=j;for(let le=0;lehe===0?0:le+fe||0,0),te=this.measureText(R),ne=Math.max(te+J,0);this.textWidth=te,this.textHeight=this.getFontSize(),this.glyphInfo=[];const ie=this.getPathLength(),re=this.getStyle("startOffset").getNumber(0)*ie;let oe=0;(q==="middle"||q==="center")&&(oe=-ne/2),(q==="end"||q==="right")&&(oe=-ne),oe+=re,D.forEach((le,fe)=>{const{offset:he,segment:ge,rotation:ce}=this.findSegmentToFitChar(R,q,ne,ie,G,oe,W,le,fe);oe=he,!(!ge.p0||!ge.p1)&&this.glyphInfo.push({text:D[fe],p0:ge.p0,p1:ge.p1,rotation:ce})})}parsePathData(R){if(this.pathLength=-1,!R)return[];const F=[],{pathParser:D}=R;for(D.reset();!D.isEnd();){const{current:G}=D,U=G?G.x:0,W=G?G.y:0,q=D.next();let Y=q.type,K=[];switch(q.type){case PathParser.MOVE_TO:this.pathM(D,K);break;case PathParser.LINE_TO:Y=this.pathL(D,K);break;case PathParser.HORIZ_LINE_TO:Y=this.pathH(D,K);break;case PathParser.VERT_LINE_TO:Y=this.pathV(D,K);break;case PathParser.CURVE_TO:this.pathC(D,K);break;case PathParser.SMOOTH_CURVE_TO:Y=this.pathS(D,K);break;case PathParser.QUAD_TO:this.pathQ(D,K);break;case PathParser.SMOOTH_QUAD_TO:Y=this.pathT(D,K);break;case PathParser.ARC:K=this.pathA(D);break;case PathParser.CLOSE_PATH:PathElement.pathZ(D);break}q.type!==PathParser.CLOSE_PATH?F.push({type:Y,points:K,start:{x:U,y:W},pathLength:this.calcLength(U,W,Y,K)}):F.push({type:PathParser.CLOSE_PATH,points:[],pathLength:0})}return F}pathM(R,F){const{x:D,y:G}=PathElement.pathM(R).point;F.push(D,G)}pathL(R,F){const{x:D,y:G}=PathElement.pathL(R).point;return F.push(D,G),PathParser.LINE_TO}pathH(R,F){const{x:D,y:G}=PathElement.pathH(R).point;return F.push(D,G),PathParser.LINE_TO}pathV(R,F){const{x:D,y:G}=PathElement.pathV(R).point;return F.push(D,G),PathParser.LINE_TO}pathC(R,F){const{point:D,controlPoint:G,currentPoint:U}=PathElement.pathC(R);F.push(D.x,D.y,G.x,G.y,U.x,U.y)}pathS(R,F){const{point:D,controlPoint:G,currentPoint:U}=PathElement.pathS(R);return F.push(D.x,D.y,G.x,G.y,U.x,U.y),PathParser.CURVE_TO}pathQ(R,F){const{controlPoint:D,currentPoint:G}=PathElement.pathQ(R);F.push(D.x,D.y,G.x,G.y)}pathT(R,F){const{controlPoint:D,currentPoint:G}=PathElement.pathT(R);return F.push(D.x,D.y,G.x,G.y),PathParser.QUAD_TO}pathA(R){let{rX:F,rY:D,sweepFlag:G,xAxisRotation:U,centp:W,a1:q,ad:Y}=PathElement.pathA(R);return G===0&&Y>0&&(Y-=2*Math.PI),G===1&&Y<0&&(Y+=2*Math.PI),[W.x,W.y,F,D,q,Y,U,G]}calcLength(R,F,D,G){let U=0,W=null,q=null,Y=0;switch(D){case PathParser.LINE_TO:return this.getLineLength(R,F,G[0],G[1]);case PathParser.CURVE_TO:for(U=0,W=this.getPointOnCubicBezier(0,R,F,G[0],G[1],G[2],G[3],G[4],G[5]),Y=.01;Y<=1;Y+=.01)q=this.getPointOnCubicBezier(Y,R,F,G[0],G[1],G[2],G[3],G[4],G[5]),U+=this.getLineLength(W.x,W.y,q.x,q.y),W=q;return U;case PathParser.QUAD_TO:for(U=0,W=this.getPointOnQuadraticBezier(0,R,F,G[0],G[1],G[2],G[3]),Y=.01;Y<=1;Y+=.01)q=this.getPointOnQuadraticBezier(Y,R,F,G[0],G[1],G[2],G[3]),U+=this.getLineLength(W.x,W.y,q.x,q.y),W=q;return U;case PathParser.ARC:{U=0;const K=G[4],Z=G[5],j=G[4]+Z;let Q=Math.PI/180;if(Math.abs(K-j)j;Y-=Q)q=this.getPointOnEllipticalArc(G[0],G[1],G[2],G[3],Y,0),U+=this.getLineLength(W.x,W.y,q.x,q.y),W=q;else for(Y=K+Q;Y5&&arguments[5]!==void 0?arguments[5]:F,q=arguments.length>6&&arguments[6]!==void 0?arguments[6]:D;const Y=(U-D)/(G-F+PSEUDO_ZERO);let K=Math.sqrt(R*R/(1+Y*Y));GF)return null;const{dataArray:U}=this;for(const W of U){if(W&&(W.pathLength<5e-5||D+W.pathLength+5e-5=0&&Y>j)break;G=this.getPointOnEllipticalArc(W.points[0],W.points[1],W.points[2],W.points[3],Y,W.points[6]);break}case PathParser.CURVE_TO:Y=q/W.pathLength,Y>1&&(Y=1),G=this.getPointOnCubicBezier(Y,W.start.x,W.start.y,W.points[0],W.points[1],W.points[2],W.points[3],W.points[4],W.points[5]);break;case PathParser.QUAD_TO:Y=q/W.pathLength,Y>1&&(Y=1),G=this.getPointOnQuadraticBezier(Y,W.start.x,W.start.y,W.points[0],W.points[1],W.points[2],W.points[3]);break}if(G)return G;break}return null}getLineLength(R,F,D,G){return Math.sqrt((D-R)*(D-R)+(G-F)*(G-F))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((R,F)=>F.pathLength>0?R+F.pathLength:R,0)),this.pathLength}getPointOnCubicBezier(R,F,D,G,U,W,q,Y,K){const Z=Y*CB1(R)+W*CB2(R)+G*CB3(R)+F*CB4(R),j=K*CB1(R)+q*CB2(R)+U*CB3(R)+D*CB4(R);return{x:Z,y:j}}getPointOnQuadraticBezier(R,F,D,G,U,W,q){const Y=W*QB1(R)+G*QB2(R)+F*QB3(R),K=q*QB1(R)+U*QB2(R)+D*QB3(R);return{x:Y,y:K}}getPointOnEllipticalArc(R,F,D,G,U,W){const q=Math.cos(W),Y=Math.sin(W),K={x:D*Math.cos(U),y:G*Math.sin(U)};return{x:R+(K.x*q-K.y*Y),y:F+(K.x*Y+K.y*q)}}buildEquidistantCache(R,F){const D=this.getPathLength(),G=F||.25,U=R||D/100;if(!this.equidistantCache||this.equidistantCache.step!==U||this.equidistantCache.precision!==G){this.equidistantCache={step:U,precision:G,points:[]};let W=0;for(let q=0;q<=D;q+=G){const Y=this.getPointOnPath(q),K=this.getPointOnPath(q+G);!Y||!K||(W+=this.getLineLength(Y.x,Y.y,K.x,K.y),W>=U&&(this.equidistantCache.points.push({x:Y.x,y:Y.y,distance:q}),W-=U))}}}getEquidistantPointOnPath(R,F,D){if(this.buildEquidistantCache(F,D),R<0||R-this.getPathLength()>5e-5)return null;const G=Math.round(R/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[G]||null}constructor(R,F,D){super(R,F,D),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const G=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(G)}}const dataUriRegex=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ImageElement extends RenderedElement{async loadImage(R){try{const F=await this.document.createImage(R);this.image=F}catch(F){console.error('Error while loading image "'.concat(R,'":'),F)}this.loaded=!0}async loadSvg(R){const F=dataUriRegex.exec(R);if(F){const D=F[5];D&&(F[4]==="base64"?this.image=atob(D):this.image=decodeURIComponent(D))}else try{const G=await(await this.document.fetch(R)).text();this.image=G}catch(D){console.error('Error while loading image "'.concat(R,'":'),D)}this.loaded=!0}renderChildren(R){const{document:F,image:D,loaded:G}=this,U=this.getAttribute("x").getPixels("x"),W=this.getAttribute("y").getPixels("y"),q=this.getStyle("width").getPixels("x"),Y=this.getStyle("height").getPixels("y");if(!(!G||!D||!q||!Y)){if(R.save(),R.translate(U,W),typeof D=="string"){const K=F.canvg.forkString(R,D,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:q,scaleHeight:Y}),{documentElement:Z}=K.document;Z&&(Z.parent=this),K.render()}else F.setViewBox({ctx:R,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:q,desiredWidth:D.width,height:Y,desiredHeight:D.height}),this.loaded&&(!("complete"in D)||D.complete)&&R.drawImage(D,0,0);R.restore()}}getBoundingBox(){const R=this.getAttribute("x").getPixels("x"),F=this.getAttribute("y").getPixels("y"),D=this.getStyle("width").getPixels("x"),G=this.getStyle("height").getPixels("y");return new BoundingBox(R,F,R+D,F+G)}constructor(R,F,D){super(R,F,D),this.type="image",this.loaded=!1;const G=this.getHrefAttribute().getString();if(!G)return;const U=G.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(G);R.images.push(this),U?this.loadSvg(G):this.loadImage(G)}}class SymbolElement extends RenderedElement{render(R){}constructor(...R){super(...R),this.type="symbol"}}class SVGFontLoader{async load(R,F){try{const{document:D}=this,U=(await D.canvg.parser.load(F)).getElementsByTagName("font");Array.from(U).forEach(W=>{const q=D.createElement(W);D.definitions[R]=q})}catch(D){console.error('Error while loading font "'.concat(F,'":'),D)}this.loaded=!0}constructor(R){this.document=R,this.loaded=!1,R.fonts.push(this)}}class StyleElement extends Element$1{constructor(R,F,D){super(R,F,D),this.type="style",compressSpaces(Array.from(F.childNodes).map(W=>W.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(W=>{const q=W.trim();if(!q)return;const Y=q.split("{"),K=Y[0].split(","),Z=Y[1].split(";");K.forEach(j=>{const Q=j.trim();if(!Q)return;const J=R.styles[Q]||{};if(Z.forEach(te=>{const ne=te.indexOf(":"),ie=te.substr(0,ne).trim(),re=te.substr(ne+1,te.length-ne).trim();ie&&re&&(J[ie]=new Property(R,ie,re))}),R.styles[Q]=J,R.stylesSpecificity[Q]=getSelectorSpecificity(Q),Q==="@font-face"){const te=J["font-family"].getString().replace(/"|'/g,"");J.src.getString().split(",").forEach(ie=>{if(ie.indexOf('format("svg")')>0){const re=parseExternalUrl(ie);re&&new SVGFontLoader(R).load(te,re)}})}})})}}StyleElement.parseExternalUrl=parseExternalUrl;class UseElement extends RenderedElement{setContext(R){super.setContext(R);const F=this.getAttribute("x"),D=this.getAttribute("y");F.hasValue()&&R.translate(F.getPixels("x"),0),D.hasValue()&&R.translate(0,D.getPixels("y"))}path(R){const{element:F}=this;F&&F.path(R)}renderChildren(R){const{document:F,element:D}=this;if(D){let G=D;if(D.type==="symbol"&&(G=new SVGElement(F),G.attributes.viewBox=new Property(F,"viewBox",D.getAttribute("viewBox").getString()),G.attributes.preserveAspectRatio=new Property(F,"preserveAspectRatio",D.getAttribute("preserveAspectRatio").getString()),G.attributes.overflow=new Property(F,"overflow",D.getAttribute("overflow").getString()),G.children=D.children,D.styles.opacity=new Property(F,"opacity",this.calculateOpacity())),G.type==="svg"){const W=this.getStyle("width",!1,!0),q=this.getStyle("height",!1,!0);W.hasValue()&&(G.attributes.width=new Property(F,"width",W.getString())),q.hasValue()&&(G.attributes.height=new Property(F,"height",q.getString()))}const U=G.parent;G.parent=this,G.render(R),G.parent=U}}getBoundingBox(R){const{element:F}=this;return F?F.getBoundingBox(R):null}elementTransform(){const{document:R,element:F}=this;return F?Transform.fromElement(R,F):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...R){super(...R),this.type="use"}}function imGet(B,R,F,D,G,U){return B[F*D*4+R*4+U]}function imSet(B,R,F,D,G,U,W){B[F*D*4+R*4+U]=W}function m(B,R,F){return B[R]*F}function c(B,R,F,D){return R+Math.cos(B)*F+Math.sin(B)*D}class FeColorMatrixElement extends Element$1{apply(R,F,D,G,U){const{includeOpacity:W,matrix:q}=this,Y=R.getImageData(0,0,G,U);for(let K=0;K{J.addBoundingBox(te.getBoundingBox(R))}),G=Math.floor(J.x1),U=Math.floor(J.y1),W=Math.floor(J.width),q=Math.floor(J.height)}const Y=this.removeStyles(F,MaskElement.ignoreStyles),K=D.createCanvas(G+W,U+q),Z=K.getContext("2d");D.screen.setDefaults(Z),this.renderChildren(Z),new FeColorMatrixElement(D,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(Z,0,0,G+W,U+q);const j=D.createCanvas(G+W,U+q),Q=j.getContext("2d");D.screen.setDefaults(Q),F.render(Q),Q.globalCompositeOperation="destination-in",Q.fillStyle=Z.createPattern(K,"no-repeat"),Q.fillRect(0,0,G+W,U+q),R.fillStyle=Q.createPattern(j,"no-repeat"),R.fillRect(0,0,G+W,U+q),this.restoreStyles(F,Y)}render(R){}constructor(...R){super(...R),this.type="mask"}}MaskElement.ignoreStyles=["mask","transform","clip-path"];const noop=()=>{};class ClipPathElement extends Element$1{apply(R){const{document:F}=this,D=Reflect.getPrototypeOf(R),{beginPath:G,closePath:U}=R;D&&(D.beginPath=noop,D.closePath=noop),Reflect.apply(G,R,[]),this.children.forEach(W=>{if(!("path"in W))return;let q="elementTransform"in W?W.elementTransform():null;q||(q=Transform.fromElement(F,W)),q&&q.apply(R),W.path(R),D&&(D.closePath=U),q&&q.unapply(R)}),Reflect.apply(U,R,[]),R.clip(),D&&(D.beginPath=G,D.closePath=U)}render(R){}constructor(...R){super(...R),this.type="clipPath"}}class FilterElement extends Element$1{apply(R,F){const{document:D,children:G}=this,U="getBoundingBox"in F?F.getBoundingBox(R):null;if(!U)return;let W=0,q=0;G.forEach(re=>{const oe=re.extraFilterDistance||0;W=Math.max(W,oe),q=Math.max(q,oe)});const Y=Math.floor(U.width),K=Math.floor(U.height),Z=Y+2*W,j=K+2*q;if(Z<1||j<1)return;const Q=Math.floor(U.x),J=Math.floor(U.y),te=this.removeStyles(F,FilterElement.ignoreStyles),ne=D.createCanvas(Z,j),ie=ne.getContext("2d");D.screen.setDefaults(ie),ie.translate(-Q+W,-J+q),F.render(ie),G.forEach(re=>{typeof re.apply=="function"&&re.apply(ie,0,0,Z,j)}),R.drawImage(ne,0,0,Z,j,Q-W,J-q,Z,j),this.restoreStyles(F,te)}render(R){}constructor(...R){super(...R),this.type="filter"}}FilterElement.ignoreStyles=["filter","transform","clip-path"];class FeDropShadowElement extends Element$1{apply(R,F,D,G,U){}constructor(R,F,D){super(R,F,D),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class FeMorphologyElement extends Element$1{apply(R,F,D,G,U){}constructor(...R){super(...R),this.type="feMorphology"}}class FeCompositeElement extends Element$1{apply(R,F,D,G,U){}constructor(...R){super(...R),this.type="feComposite"}}class FeGaussianBlurElement extends Element$1{apply(R,F,D,G,U){const{document:W,blurRadius:q}=this,Y=W.window?W.window.document.body:null,K=R.canvas;K.id=W.getUniqueId(),Y&&(K.style.display="none",Y.appendChild(K)),processCanvasRGBA(K,F,D,G,U,q),Y&&Y.removeChild(K)}constructor(R,F,D){super(R,F,D),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class TitleElement extends Element$1{constructor(...R){super(...R),this.type="title"}}class DescElement extends Element$1{constructor(...R){super(...R),this.type="desc"}}const elements={svg:SVGElement,rect:RectElement,circle:CircleElement,ellipse:EllipseElement,line:LineElement,polyline:PolylineElement,polygon:PolygonElement,path:PathElement,pattern:PatternElement,marker:MarkerElement,defs:DefsElement,linearGradient:LinearGradientElement,radialGradient:RadialGradientElement,stop:StopElement,animate:AnimateElement,animateColor:AnimateColorElement,animateTransform:AnimateTransformElement,font:FontElement,"font-face":FontFaceElement,"missing-glyph":MissingGlyphElement,glyph:GlyphElement,text:TextElement,tspan:TSpanElement,tref:TRefElement,a:AElement,textPath:TextPathElement,image:ImageElement,g:GElement,symbol:SymbolElement,style:StyleElement,use:UseElement,mask:MaskElement,clipPath:ClipPathElement,filter:FilterElement,feDropShadow:FeDropShadowElement,feMorphology:FeMorphologyElement,feComposite:FeCompositeElement,feColorMatrix:FeColorMatrixElement,feGaussianBlur:FeGaussianBlurElement,title:TitleElement,desc:DescElement};function createCanvas(B,R){const F=document.createElement("canvas");return F.width=B,F.height=R,F}async function createImage(B){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const F=document.createElement("img");return R&&(F.crossOrigin="Anonymous"),new Promise((D,G)=>{F.onload=()=>{D(F)},F.onerror=(U,W,q,Y,K)=>{G(K)},F.src=B})}const DEFAULT_EM_SIZE=12;class Document$1{bindCreateImage(R,F){return typeof F=="boolean"?(D,G)=>R(D,typeof G=="boolean"?G:F):R}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:R}=this;return R[R.length-1]||DEFAULT_EM_SIZE}set emSize(R){const{emSizeStack:F}=this;F.push(R)}popEmSize(){const{emSizeStack:R}=this;R.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(R=>R.loaded)}isFontsLoaded(){return this.fonts.every(R=>R.loaded)}createDocumentElement(R){const F=this.createElement(R.documentElement);return F.root=!0,F.addStylesFromStyleDefinition(),this.documentElement=F,F}createElement(R){const F=R.nodeName.replace(/^[^:]+:/,""),D=Document$1.elementTypes[F];return D?new D(this,R):new UnknownElement(this,R)}createTextNode(R){return new TextNode(this,R)}setViewBox(R){this.screen.setViewBox({document:this,...R})}constructor(R,{rootEmSize:F=DEFAULT_EM_SIZE,emSize:D=DEFAULT_EM_SIZE,createCanvas:G=Document$1.createCanvas,createImage:U=Document$1.createImage,anonymousCrossOrigin:W}={}){this.canvg=R,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=R.screen,this.rootEmSize=F,this.emSize=D,this.createCanvas=G,this.createImage=this.bindCreateImage(U,W),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}Document$1.createCanvas=createCanvas;Document$1.createImage=createImage;Document$1.elementTypes=elements;class Canvg{static async from(R,F){let D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const U=await new Parser(D).parse(F);return new Canvg(R,U,D)}static fromString(R,F){let D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const U=new Parser(D).parseFromString(F);return new Canvg(R,U,D)}fork(R,F){let D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.from(R,F,{...this.options,...D})}forkString(R,F){let D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.fromString(R,F,{...this.options,...D})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...R}),await this.ready(),this.stop()}start(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:F,screen:D,options:G}=this;D.start(F,{enableRedraw:!0,...G,...R})}stop(){this.screen.stop()}resize(R){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:R,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(R,F,D)}constructor(R,F,D={}){this.parser=new Parser(D),this.screen=new Screen(R,D),this.options=D;const G=new Document$1(this,D),U=G.createDocumentElement(F);this.document=G,this.documentElement=U}}globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;globalThis&&globalThis.__awaiter;const bg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbwAAACNCAYAAADM4c9jAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABvKADAAQAAAABAAAAjQAAAADzprXxAABAAElEQVR4Ae2dd3Ndx3n/0UkUkiCIRoINJEWKtOXEtib515q0iTNOMsnIM7El9yLbif/IG7D1BpIZZyzZcpMcSeNYk+IUj1McyxlPEmtk/2JLIsUOkAAJgOgEQHT8Pt/l3aNT7z3nFtQ9M/eec7Y8++yzu0/bcqqr8lxra2vVo6OjLTU1Na08N6+srDTwXEeW6jzZdkrUWm1t7dLq6upSdXX1TFtb2yQVn+V5bacQwNXTUcBRwFFgK1EgVnBJ0E1PT++/d+9eD0y9YStVaCNxRSFY4Bo8duzYxEbi4cp2FHAUcBRwFIhSICLwXn311XoY9gmStviTY7nM1tXVLcDUlxCIO96KgR7VKAP1y8vLuyFHk59WvE+/8cYb1x955JFlf7h7dhRwFHAUcBTYOAoEBN7Nmzcbm5ubT8l1KZRw14lhDxE+/vDDDy9tHJqbu2QEXP2dO3cOgGW35KCwlbXX1dV1mfeFzY29w85RwFHAUWBnUMATeLLsTpw48aAVdvX19eP79u27AcNe2RmkKL2WCL66qampY0tLS62ClhN6FxwNS6etg+Ao4CjgKFAqBYzAg1FrccppgBk3Jgx6qL29fbBU4Dsxv2g5Pj5+GOu4U/VvaGiYQnG4shNp4ersKOAo4CiwmShQI2S0QIWbEXay7JywK76JUBbWWLE5gOCbEpTFxcV9CMB9xUN0OR0FHAUcBRwFykGBGlkkWo0pYJqzkxuzHIB3MgwJvY6Ojj5ouyo6sHLz8E6mh6u7o4CjgKPAZqBAjfbZ+bYeDLn5pvI0C3Rc5jckaKxujazkLE8pDoqjgKOAo4CjQFoKsI+8xiywUAatxkyb0aUrTIHJyUmPnigWHp0L53QpHAUcBRwFHAXKTYEa3G12ocqs23pQXvI+8MADC+zTm89BDexrLG9JDpqjgKOAo4CjQCEK1GjztBLBmN1+sULUKiIe+hq6YkkbOhcBwmVxFHAUcBRwFCgDBeTS1NmYVazOdBvLy0DQMAhLV/bkOYEXJo57dxRwFHAUWEcKaFuC3Yu3448LqwTdWalp6ept8q9EOQ6mo4CjgKOAo0B+Cph9ePmTuFhHAUcBRwFHAUeBrU8B487c7NX47ne/28jVxvL+FjZy7wLfWlyx1cw7VuMy1LL/NVyG2vO2gkGl8z8XCGN74b17HPM19/73v39xs9fR4eco4CjgKOAoUFkKbFqB96Mf/agV4dbNr0mCjZ8W1hhqSMjpx0HXVQg0hVUj4HRocy3vOvhaefYrja5//Md/nOeaRGhOvO9975szge5vU1Pgi1/8Yg0n1tR3d3evPfroo/rmoHUNb2q8HXJbgwIo0bUowu6c4K3RXGXDsppT/t8taNokvdFHimGdVf/nf/7nUbZKtPGLuFubmpqMoPPXPifwvKBC71iC85wocxsmOrEeTJRjxY5SZgd1W+3s7Px/HqIVfhAtn3322X3c132xDCtTV48ePToV93kkCbJf+7Vfq//d3/1dCTFzEk2YFE899dR+ziA9Du6mD2DNL+/Zs+cqDGomnNa9Owrko4D627lz53ZxfGIjCnAjTp8m+mcjeerpV7c//vGP38qX38VtLwpsGgvvhz/8Yc8///M/d8maC5NYgk4/e4WFmg1Pc0fY7SZd79/8zd90Pf/884OPPfbYdJp8Wy3NM888c4QB3bEReCPgq65evbqAwHrDr1R861vf2k37nh4cHKz/+te/XsVvgbaceOKJJ27508GQDlthJ/xpszo27uv4u4sbUZ+tVCZ0q37hhRf24NHQ+bh7oN0i+0GvxSkfaeulKYXZ2VlNJWyqi35Wox9XLfWs2b17dw31rkWw1dGvGgiXt6eeL5gYvPEWVdG3vDrQ53QYhBN4HkW2/8OGC7z//u//bhwbGzuNBhbBRS5JzvYMtEJY2ClNOCyQwffiT8dgaKLDP/Cd73znLs99222ej7rt8VV93R9hvLteeuklWZfe/CnMqYt3z+JUGlzR3ViiY4TbDfrC1UujF12ki/SP+zE7+1+uORh5MwKpGWbe/LWvfa2Ftve4Os+7Ll26dAgq3SiGUhKgKE9nGSMRRbQYeOXOA14GpO4SaLpL4bLh+cojXSNTJ3WlKAP54Lu4zUeBDWUiP/jBD9qGh4d748hihV0hgeYXYmE44bg4WHT6PaQ7++1vf/vKhz70odkwDPdePAWGhoYCTBJa741jRMzFBlybMG747Fogb/FYZM/51a9+tZ4+sRc8PMGRHUp5cyDvq2XF6Ec/ruO+C1o2YL0Yy0t0hWaamogruB3BOFSMUvfkk09W9/T0xAKNK2irhV24cEGK4cRWw9vhWxwFNkzg/cd//EcX/nTzlYY41OXClMDST4LKXnFCy8aF72nTwizEQM7gCrr+wQ9+cFt0fhikVq6GSbKu71pwYguE4Yo5y8UUvpbCjBi8q+MEYzhjJd5xc+/FLXaS8iNzyJUoLwtMoaSfFWy6p7nIUw3t9X3GgTTpd1IaFATNlWyLMb+T2q3Yum6YwPuN3/iNETrbsBD/3//9372ao0G4eRN11u9uKybXZloBpjx+ISmhqcvezQt/fnhiCsSfwCU08MlPftLgZdNtxTvMcBK8NTm/IRflz2t1pS0c5SbJxXrXptkMd1yDx+gLm07YlUobFKD7S5xLBbQN8sN3VvnNoeTOHjhw4M42qJKrQkoKbKpVmt/73ve66ISJ346LE3oSYhJcrDA1P6XxL3CxdFA6CVEEq/ndvn07IgCtQGSF6JVPf/rT92e6LYAi7xu1SlPo4qZtxloy5jECx7ilRB/7TJI9CKb2cNVYWDLGAgAJTC0yiVjh5NG856jyYQ0F3F2spqxCaKzSHtNYbp6JiSLRS/I25fFfwJmhjHt4Dw0c3Xk/4E+jZ8pcgWmP0UZeeTaPwoCzun///nHKLHolZ84KfShc9lZ+V1vxG6c/m/bKWhfyVrO46F1Z822G9PT9ZfrIIv1jYdeuXfPUZZ73uY985CMLCLx05vFmqIjDoWwU2FQCT7VipeaJubk5s4dOAshvqSleDNteEmwsf686ePCgDUp9F+wbN25Uvfnmm0YQKqPCdDEwVrq6ui68973vLflA7Y0UeKYyef6ee+65A0z0Hw8nQbAMfvSjHx1iLqsJQXI2HI9ScgcGmnoRhJjmN7/5zXeQr6IeBeCvsZ3hPLj7F8CE0U98//KXv9xC/jOJCbZGxBJ0mGXcTNOfJ2knz8ouFn36wT76gVY3V+RCCEkx06rSwIVQmiI8cV5dSg7XCvlXSSeFaBVlaeXIkSMrr7zyyhJbEgJzwwHg7mVHUqCiDCgrRWGMNQg84/qywkcw9CzBZ4WdniXo9Cv2EoyTJ0+an6y9n/70p57gY6DVDgwMnELjf9NvpRRb1k7Px766ZgRJxfsaDLCaPqT+U5TAwwpoIP+WaS6Y/SJ9VVs77rW2ts7Qp2fD86HlqEzO21EWj0ccPgjUdtouIvAIm/rEJz7hXI5xRHNhRVGg4kwoLVayAjgR5e24EwM4+YWdhJR+Dz30UKzbMm1Z4XSyEP/wD/+w6rXXXjM/lQkj2Y0LVKbjQDi9e89GAYTdun38lv7juTyzYckxPbW1DVgIkWzgP0Rf2NC5RlayrtH3V3E1y2pZcafPRJrJBTgKFKRAQLgUTF3BBGxROA2zems5pq8sWXZW2L3rXe+KuDl9SUt6lCCV1fhv//ZvVbhVteG580tf+tKdz3/+8yW7NktCbItnho770dbXpRYoTkW78HDvarNyBE8E4V36wLY8oCBSWRfgKLCNKbApBB6bP7s54iz2i+BW2KkNJJAk+Cp5qTxZexJ6uDqrOX9Tm3avV7LM7Qz7G9/4hk77iNuOUPZqa87nM5/5zORnP/vZomDLwotzaWLxe5vniwK8BTNpPlMu3nVCvTmB7o2aP1wPHFjwtIg7+N56lOXK2DgKbLjA00kHCLueOBJIuNkVl5pvs89xacsZpnJ/7/d+r+pf/uVfJPTaGHTDzGO4Q6eLIDLCLrIKVGAQTqNY0UNxIHHbnSU+sOkbOIswpYtx6RV2/vz5VRYpLDPnk5SkYDjuzAaEXiQdq/oWWQgTCd+uAdCxTot34oTQetYZa1tH463L8XgTExNUd+3/6Hduoct6NvI6l7XhAg+mdyKpznaRigRdMSsxBVdbEfyCM6msuPDf/u3frvqHf/iHKo4906Drj0uzmcMYwDWsjuzGVbwHGkR8dWwpqItz4cH4O9lGsF/54+rHarj9xDeH4ySUtJ3hwx/+8JjipMxwrFWsO5NFdYmuYqzCNWCFwVdVYkGGvxBoEbFoCFveaUyQsVb0PKifnlvpmXaufvnll9Xfox1vK1XE4ZqXArEMLW+OMka+8cYbDezZMqsyw2D9QqoYYac5OAkrznOsevHFF421Fi6j0Ltw4Jw9zeWJ+W85JoBlehLcD1IPuYu1qT/wi2PwOZrIb6yzRmOXogNTilIAlt6Bp086Hc/tudOWjzYxkhxM74awu7fZLGZW5NaGrUohTF13nDvTayj34CiwzSiwoRZef3//kSR6WvelhE4xAu8nP/mJ2WBu4dutB7/+679ug1LdZWV2dHTUPsundsigzdhb4vr+97+/i68S7N0gZOUGHkfYRaxA4YPyUNQm6ArXJWLdqbxyCzztfUTg72Ne0GyWh0ajfKJmQ1eAVpiuDryjwKahwIYKPE78SJyQ9rszi6GWBFz4igvzp1G8fnKD2p+2KOQu7RPaMgKPesQycFuZSt9h5FqsohNZAqeryD3IcU7G5VlpHLLAZw4ndoUmMLwOkAVeXFo+j2QsYMVBF5ME9/F+VgK/sZlWAp8+fXrtypUrcVXY1mGsJdg6mzC3dUtUrnKZBd6rr77a9PDDD5e8gENwLl68aNxdsuL8l//dCj5/fJpnWYgSWv7LWo3+MD3z7baqn//852Yrgj/OJ+z0tfVYa8Wf3j2/RQHoVceKyVEsPTF3rXQ1jczzwGbczE+fa8DyeqsCuSfqUTaXJnWP9CHCqpkTlXt402x90edyaLcrokmEIKEAcK9Gce2iHnnTovyskXYIhSeiQEB3udwDilGumHEWEcUeFUceLYYS3QpelDuGV8Gc2OLfp8nexir7TpqFzdgvC1bOJchEgUwC75/+6Z+a6Nxnf/azny3RgWTtTL373e++K609U6kkRqM2q/ck3KxgsYLOL5hsWFb4cl1qa4H/0h6+8CVBp+PFCl3Ud5fmebbDoLDtBdOQWy0yxybmBKPR1xZi40WrQjAsPZmrG4V2Yzptpbe3d6kcx7VZ2OW8a0sC9Y2AZGl+2QQe85sRWqvAYpW6CLJlDMidrpIXoixW+IE+NFxI2C2yveda0ue3EK5rwIgIPHkIOMg91v1Nnxql/HYUkh76YnRprQ9z0hzgJ8VrECUsInB9Sd3jNqdAJoEHLdpzwqmeTmaWDP/iF79YxVqbJk7m1BTWX6oORQc0J/n7hZ3/uVS6awO59tPJetP14IMPRhiLPUszbVm4PIRzrMaZFsYmSDfM0v0B4ZF0liZL0m99lLM0dfg0GvCDYZxpuzEYR5/Cc18xf1s4jf+dviJX0aammzad+3G2z9S/bALPwtzqdxS/Rs6IPUw/iP2+Yah+42wnuVFuRTHXp+6wEngChfUwFlrkwHE/HopHSLY+/fTTt5544ok7ufz+JO55B1Agk8BDIDVr9aNfI0UrrqHz6OioVgms//mf/5nDKjPWXz7XJ2kDZVthV06a2y8oJMHUUWL2SlO+rDzSb2rGbevj7tkoICsFiyKSiQVLTuDlqIIlVo8lfIipgnbuEVr5AxgrK9D0BsrVuD+83M9yvwKzj43yo+B0lF/iJ7HgU7UIviPUo530Nz73uc+5sVzuBtnk8AJCpxCu7NuSZZc3GfFNaH7yrR/6r//6ryU6/SRuj6nf/M3fDLg+YS6ptkRIwFbiElz/HJ/ftary0gjASuC1HWHC/Kr15ey0dZMrtVA/SwsrbTr6bOyiFf83/dLC2m7ptJ8Sb0gXY6KTtiw4bmm7KcZ3P8IulbenHPSS8AK3C1/5ylc6JJTBIVEiSyjyO4N3YgzLfhD37brhWY66OhjFUyCTwFMnyieAwkKD9PV0wg42I3cg/FZ/+MMfTiMAp/hm2tTQ0JA0s1g3kr86+crzp8v67Bd2yusXcAzWNXAH9eDgpn6pmXZWfDYiPYM9tv2pd3Qyq0gE2UR+6Jlnnunu6ekpiXaywNjf9+40aAh/NPnBj33sY3dSptc33yJ9kX6grxHs2JV7EnTXrl3rxGXYBT0LCjraaJl0A/bggTS0L2eaXFuNYMFNMFZ7UGLyujkVT55WXPe3Hn/8cefmLGdjbFJYsQwvCVc6SDVWnve5nnA6v9AIx1nXJ8yolZNLtOghkan64Ugw6V3CtJyXvwwLF5xWCe/n00CTX/jCF9bYtN5M+UeIN6vBqEMizhbGFrvHEhU6lE3jpb21gq8kYZeVpuBfS1PpSxepBB7tHEsHmPe6uDMZVzVaEJW1nmnSY6Hq696ZhDa4NDBf3cX8dzvtVwMdChaFxTSCFXhbx7sVTFzhBDmLrY96jM7MzBylL+R1czJP69ycFW6TzQK+cE+OwVRfDS9mM7gFJWHDIEoc4LLq/POEpZZny/XfwwJU7zAeb86BgavkcpO8+eyzz8qd08OcoFna7IezlZ/FCGBUkSpA/7IxLTHMSAHrEJCx3Ih1JxSx8FrSWpWlVAlL+zi/UkAk5sW6XsPKHmJz+63ERL6IF154YT8rqHtZuCQXhy8m/pE0d/kW300WpZRy8HLSvEVSeDwyoVBwMm5OrPdOxvYheE5iX8y5OU8A4pchMO51G1EgsQPE1VGuPoWH3YFxafOFWWFj7+G0Enh+C0yrKct9hctW3a5fvz4RLkfasVYsEn6NAVQZrhQudB3eZVFQt8ixbqID2n1JjGYd0C9rEXgcYgVeWQvZIGCyrmnTg2xu14KrghfWjs5XLWiRA3MRAXL1U5/61KUShV0VFtkc8PolPLnP6o7A7VN4QYQLJND4ZWvDMHV6naSFFtAUii9Qmove7BTIZOEhJFbQRGskkCT0/FZYlopaYRa3OdzCEXytstSl9NpeoC8mlOvy7/UTTAbZIlZddJlerkA+ORMRhuXCZSPgoMXrUOcIYxOzyUeHrLhSxjJMLFM/y1pGXHoYXeqN3NQ51qUZB3erhmHBqI4FadLS0jI+OTmZb2+b3N3DnORzp5z9BOGm/Xaxe+7KQfOcm/M61u4ono2j9I/AObES4AjvWwjHchTnYGxSCmRiRDAvdXbDHHQEV1jgyWqywixNfZU+KY8EnoSS4nWpPD1rf105LsHWT8JbFx2+sP+mHAVvAhiy7qDvoThUYP7B42niEmUIw5XUB3PpAm4mb0KGIiJJYe7LWAjRs+UiKe8HgJ8OUkiI3R7BLBRLVUGstRXcuBI8Xf6aSyAw/obwtoyVU9D5y1iPZ51bSlufl5uTdj9k+yX95SbviQrveuDmyqg8BTIJPDr8XVAyCzgkKDS3Zq2wLKhKcFnBKKEj4RZ3hefu5NpUvnJZehLYVuDFlb9dw8bGxrpxR93XJHyV1IAfHh4uq1sHzdocSOArZtM9wgQnWNnXrXmcTYdcGRCCqa+wUno+LSjGxQhj0gg8FJYFxuhtTkkZp3+kEpppy9modLl6DKP4TTAWDiHMV7Dstsw5uRtFt+1QbiaBhytAh/56mp+18iTAdFkhZl7y/PnTKa/f0vJnUzoJQ78lKaGnsLhjwvx50zxLWKsOumB2mWiRBv5mTMPg3oWlHntot9oX7b1sC1Y2Y/3jcBID5HoTrV+nBzXR7yKu3rh8WcMopwlFIzKXRnvMMHdWtpWxfrxk7XLSyR1Zbv7wfM+aq2aP2lX2z1brC/KiD1sNAlnkJWDu8zB0S3WeZSDzOr/kvDdy5dzOuTYNBqonD33mxf3tCApkYvJ0kHscR7WqeTxRRwLJzq1ZoWep5hdqNizurnTKq19cnrDAEwyFlePyW6cw+zoGL2N7e2ixSfSBuepUnMglpgBj1OKcghfnSzbh9jqshNAtuswzAYLoy6rBRtxHZV8kAmNfYs/YvWLdbbS73FnDCaiXJZiP8R6BXp1hYLTJMHPEm8rCYKGWwQe8wuiad+aAe8D7/iR7bIrNEwieQkYHd7fSP87vRKVu87TGxmKSSeAJVZjiJG4v76BXuQRldYXdjEkCLFxdmy6fa9MKPSsQlaccl99yFDyYsehREU27HPhWEgaWx1BO4y1YDExbrj/j/kOIFUyvBPo+H1bDSZhPI26yVHmyJBLMw4cPL2B5XJViliWvS5udAvSXRpSk7Bk3Nkf9iRMnxLtGNhYNV/pGUSDzQgIE22BY4Egg2UOa01QknL9QHmvR2Xz2XihfoXgJWXsJJsI8swJg82/lO9bNAqeSpLLuiq0nruPjOUFZLIiC+RC+u1hheKJgQpdgx1IAN21gdeaOJcQOrXhmBv+2t71t8e/+7u/uMtkb2MNlhZ5WURYSSNZSC9Pcb+UJhnV3Kp3/OZyvlHdbTg5+avdcKWVuprxy5e3du/dqzqUXQA3moM+2BMKKecmtCm0pJm/WPNRjt/acVeKDqhw43II7V8dRLXHwwthGfeqIpfUae4ekQCDkx1lOrxWG6UztrARNSI91tyX3pGKZlt+9kEAjF7z5KFAUN9NS8zihJvemLL1yrHy0QlF3/6/cJPRbeXfv3q3IYoVy41xmeP1JLkCssnkYaurFDnnwWldFAqFU9vL0GSSY5Wno0Q6zPzg4OPh2Frkcy1PnikQh7LSq8DS/FoRcLQpJx7OcBFSRwvIARRm6BQ6z/NbCv6Rs4XTlfk8q1x8O3yrPAgA/UPe8ZSiQ2cJTzTTXw8dgOf95qDtcUwknzelpfky/OMEYzmPf86WVENUiEysIbZ5y3VU2wm9dteRy4Z4FDkx7GoVF82/13IdYhZe4DUELQJ5//vlrnEfYu1NWsSbRkoVaWqQRUIgk/KDPxGOPPabvQVb80mHOV65c0RmhgQvcDjFHOrGeFmfOgo58ORlrvoEFLW8P00rC7fTp07/Mfc4ngH85XthW0oTF+0C+fkrfH0z6CG05cHAwNj8FirLwVK33ve99g2xmjT25QUJJe+gk+HQPC6l8gi0NycLw0uRJSmNh6c7B2Nte4MEcF/hsy+soI68h7AaT6GLDxcxZyv1LvnbwOgzjjZjfVZt2u95h4i0w8NjVrWwnWLc+w5FvWkYcWSki4cKB5+tubca1N8KuOyzslA6BN14pYYfSsRf4Z/IJO+JusPK0ovPUcfRwYZuLAkVZeLYKfDbkPFrb22dnZxOXTWpuTz+5DvUrVthJIPmFk56LhWXxD9+xIHeEfz/HNFPPweTmh2KVG4RBtV1UFKZnoXcYo+idekN0GB59YHc+JhdOX8w7Vlw17syjCXnnWOwzw8b1hOjyBuNZWcGSGYJukVNyaKM9+oL9Rn2aRzXNWXexWxWam5tTfbkiK8VwK7fBf46jiAWsbwtHliW7YK7ZbRY23N13JgVKEnhyedHJ38DSezvzX3lhySVp5/YkqPzCyj5bIWYFW7hJlM7GCVZ4W0E4fZp3C09pX3nllR25JSENnSqRBmY0zQkX14uF/fTTTx8nb95vnhUL2+bTEVQ8my0YNszesZbXfbEIC1SG2APZhoCLrDbUZ25we05VypKy9U6669SSBMEzVwlXInTQkXWHUQBiUSJuhZXXV1AUZmITuMAdR4G8QioNNaR10rFef/HFFx9CCEUWC1gh5oelML+g8cclPfuFndLIqihV4PnxwP+/LAGeVL4L33kU0EIV+oXOW4yr/Li+sh0XUckwWdusFu3HajkTLoe4Wub4jhBetBIRhpn2HVq1Miccq3yA13BaOGnS0R7VTz311GHSRjbx2/yUuYrw7eMw7CWt2u3u7jaNiMvV3PFMrb3nPe/RtwLdmLdE2wH3kgWeaESnWUGzfJ2Va2dZveWdopFVqOWjtwSeX+hpbrDUg6StxalyYSBFu9by4b3Z4mACjdKMy4UX7V2WPlQufMoFR0yVgwiOYz1EzAcxSbZyFJz/LBcuYTgStLg274CajkILX23MaY2t10IaFQ4u9Vjrx8KI5N7ndFYp88YJ0dmDZXUzXhOFnSDSfjUI4JPwpKrGxkbvdCbbnCgGVfqJjsxR38iOhcuxFSkQGczFVkJuFAbZa21tbaMSTP4rreAL5/PD8As7hcvC8wssf9q0z/78MLFt9XHXJBrAmLQfTtpxWX649SIrdZPK3krhz7LUH+ao46giF1Zf6lNpIpnLFICrTgI31gXPnNYxMfwyFZUXjBQDhM9x+lWs4oOwGWRsGasqL6AMkZS1P0PyvEmlNGj1a95ELnLbUKDsg+KP//iP+zs7O7UKMPPxToUEXpjqWgVayiUr0V47ReDZ+rp7MgW0wRzroCchxZzm0RLi1i1YUwlY67EDACbegBUUWdhSCeRwLXZBq71xsFF0K7Jlg7EamTqJKz9tGKtfy84H05bt0q0vBSrS0NoPxIA8j9/8AoJvJmydZa2i8tufP6++dJDWevTns89W4AkGe83WfT7G4uHuxVGAT94UlzFPLmn7WCwn4pJgWazRn/V9v7JaLHFlpQnTykNwSjp0ugt33Vtn56UBmDENh2F3QKskxWDp7NmzsQI5YzEuuaNA2ShQEYFnsWOv3hyC7yJLpX8Oo7jB4JhFcCWe3JEkvMhrQQbuSs/WiEBY2hfltZ8GgnHe9X82JC0Ml257UUDuuYsXL/ZSq6BPPldNLKdB+nNmz0WFqXQDvGPHFPgeU50qUb6EHa7dpO0a2nfXX6nVoliU2s7iLkeBzBRYF991TiPWPhxvLw6a9G5cCbvw8dcjfBiXa41sbeiSIJI157/s8V+KC18SWhKIWRew+N2hDM7E00bC5bn37UsBju06yr6+WPccfXiKxRcjbKPYVASQoobwGUwQPk25bRVlXSWZQtjdAq+KHeHFftkbrLbsYNxmUthRAPbI3bupGtAhs64UWBeBF1cjtD+tivRWRn7nO995uxVoVujpLmEWFoBheLLyJBT937cLpwm/W8sQRrb0J3/yJ+Mf+MAHwkm25XvOBfbW5GWJtQTeLuaStBR+3S8U/bJZL7kzKmM3TVPHRZaxbxpXZpjQuDZHEUJt4Bk5oJv+fYhl+ZPlOkwbN2l7gnA1aDFmJ/iG3v2vKocRLdN7zsrO7C6FRifA3Qm8MrXDVgSzYQLPT6x///d/39fX1xf4ErQVemmF2M9//vOqhx56qIpT7P2gY59l3dnTQThO7DZMYcfsxUHDXcBKKZv2Xel5otgGLHMgG9g7ERaxHYfwNbwQ1yrlnitHVei/a+yD60cBOEf7BpQAPCc1TCXI9Xi5lLLYo1qDF6UHgZG4HQBazY6MjPSVUo7L6yhQSQpkcglUChEGieZNIpeEXSHrzp9JQu+1117Lu5BFglTpdOG+WpB27IfhnncWBV544YX9BSzUG5U4JaTcVKYfz1OP2NWjctPi2vQ+2py1bH28l7NUz+QTdsCcY6vEZXd4Q1bquvTrSYENF3h8deFo3AktcmUmLVbJRyBZbz/5yU+8BSnhtD/96U89gcim6QFpx+E07j09BbAqNqwPYb0EJ3tzaMN4U7WpviunL0Ek1RYBMshcVNkUIpStgPWVVG6x4Tdv3hyCJt40gR8O7aRjxzJ7dCQob926dQ5YiSs+ZdkxVi/haoxdPOPHwz07CmwkBTIPgHIi+4Mf/KCNQRo5LULzcVqEImusmEsbymXFyTrkC+3GzSmYsv7sykxcPyNoxUlLuospdkvkgSHu46SVWEFRTAVQGJqBGcmKsCi4ko422ItL9MFI5hQBlFvLL3ZfQkdHR6qOw6b5Y+AZK4SwitQ/Yi2mOPSgQQ3CoYN8sXNECIUafrEbpumvBWkVV2Y4TNZV0rFj4FXHvLUOG+gL50t6p58cpl55T+WhDWcQdjqvsmLCDhx06s0BXLPaHxnbXkl18IfDT5rB1x9knu1xY5EIF7DtKLBhAu9f//Vfm7HGItq1FXbloLQEn4ScfhJ+etfFoJllocoAv3IUs6Vg5IRErKAopiJxwk5wECQF9zUiAOpgQGXtgzD2e2nn28Axyv3uE2EcYTfAlxBSkwSGrEOMtVQ/MQ+0j8RBgzUEdNm2OuQ7doz6HmCub0juzwgioQAUESlFeYUd9RmFRje4RzWeELxSXiXsoO0xxm0pYKrihB1hy8xpp1KQSircZd4UFEga8BVF7u///u9bEXYRzV4uTFlkWebtLKKFrEEbTwdfYuBfq/QgtXjtxDtCcL6/v39dPooapi/tPBgOS3qnDwyE4+gb05z7WMyKzESXX7gM/zsCb7zc1lG+Y8dQ+lIpGMAAtdV8gmwAOvWvxziSZeenWTmfqWNqK76c5TpYG0OBdRd4fE6omxNOToarq9WVEnbFXmEhaQWchad3NMQl9vppriH1t+Bs/q12p67JpkaFK8NG/j7/4oXz588vF2CeZcGIOo9l2f8Fw9b+S0/o0Udm+G7beipDSyhgqQV0WiJJgCK4b4TTI5ym2DKQ6sxYwWBMeftmLSxgLOAKvohVVNa9fRZ+3J12jZrGcQkzhkH7GfrASMZsLvkWpsC6CTwYYA3C7gzbAXrC9LLzbGEhFU6X7z2cNywAybvY2tp6MY07J185WyWOucp5hMy6CnYsuxUY4vXwqkYJP1yNY5WkHVbA0PDwcITJFypTjBvPwmvQ6gJfgC9l4UVWt9gcQumSNo4XwrGYePq5jh27RXtwW12EPn0w9yu857PaAkXhhbmtvDaQvKN8JeLCen8Wib5Tmi/TVsB3p6/e5Tuemejhy+4etygFqjnt5N3Cnc48xDaAsmubli5aIQYTPsVJ7s0STn6BpGctUpFL0y+4/M+Ck+89HOdPz7zKLAP32kZYduPj40cpv4MBtsqh2v/P0mM97tojR7v28ivbnF0c3hJ0tOEkmr9WNcYycCk8R44c6QaXVtJpfqikCya4JkbIR0/n0NRHKPf+BG1JUIvPLFqDxykg5K0b1soCgu6OLAtokVr4FI9ZaTlRUmunp6f30YfnN4rG+p4dc/sP0M8Ce3Wz1gweAIi1eeg+wgHgY1uB/lnr6NLnp8C6CTyLhjaZDwwM9LIloNYv9BQvt6Z/o3lYiBXzTie/9Ud/9EdDG9W5N1LgWZprAQKCoSLWPJv9V/iQpiy7Tc+8LT0qdYeZVr/00kv1Q0NDERccB6mLPityFVaq/O0MNx9t09Rb9H/00UeXXD9NQ63tm2bdBZ4l5fe+972uycnJQ1h8hhFL+EmgaZWmBF/Y2lO+LAIPTfoeJ2T0/87v/E6qOQuLV7nvm0HglbtODp6jgKOAo8BWpECqFVuVqNgf/MEfaNJ7+G//9m8PsnKsk8UkBhcJNW0el+CT0NMvzeUThnJtDQF/0mlzaSjn0jgKOAo4CuwMCmyYwLPk5YOxOmj2NhbfHqy9Hs62bOJXrT1zOu9Slp+EngSgfnEX1pzcRNO7du0a+63f+q2ynRMZV5YLcxRwFHAUcBTYmhSQwNPcAsZQzK7YdawTFtldintTRT7//PN7cUe2M8+nBS61HP9Ug/Az8yItLS2rCLYlhN88wvAecdO///u/P7NZrTkfXXf8HNc6didXlKOAo4CjQIQCdSzqWGZ1WT0r3vKuLovkrGDAY489pk3LG7JxudzVQmDXS5eAvrGrF8tdnoPnKOAo4CjgKBBPgRoYsdlng1uwpCW/8eBdKMu5DV1RLJzAc93BUcBRwFFgAylQg/VhVjGy7Lf51Vdf3TRW3gbSpGxFX758WR9HtXvgCp4tWbaCHSBHAUcBRwFHgQgFdIK798UANgYX/c2sCGQXUMXJLh492V/o0dmRxlHAUcBRwFFg/SlQAyOewe1mjw/qxtKrXX80tl+J0LGOX7dqhrtYpzts6Ekg24/CrkaOAo4CjgLZKCCX5horIgeVjcUrdayGPJoNhEsdpgCCThv6j0Nbs6meVaUD4TTu3VHAUcBRwFFgfSlgGDIHwk5QrJljYlVhG18z6FlfNLZPaRJ2nK5yGGFndsxzaO9UW1ub2xu4fZrY1cRRwFFgi1LACDxZeXy/7JpdsSlXHMd+9XJ37s0MDQu9ZCGfYF60U9lwFS+gTFzPAMIldRRwFHAUcBSoEAUCh9zevHmzke+BnYJRN6g87dHjNkT4+MMPP+yW1Sc0AoKuHhfmAaL1NQCjJEjYdXV1XeZ9ISGbC3YUcBRwFHAUWEcKBASeytXWhGPHjp3gMfCVYRj3LIsvFjjdZAkGv+NPDYEe1dqsD012Q47AmWe8T7/xxhvXH3nkkbJ/x2sd+4YrylHAUcBRYFtRICLwVDsYdjXfwNrP0V49MHVj7W2rWleoMrLquAZRGDQn6i5HAUcBRwFHgU1EgViBZ/GT4GMBSwurN1t5bparUys5ic+bz+bf5nd9gHRJJ6hg7M2wMEX77GZ53vHW7zZvd1c9RwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBRwFHAUcBR4H7FCj5u3Zf/epX65ubmxsFbnZ29t6nP/3ppc1O3Oeff37v0tJSDXjOf/SjH53fTPh+97vfrT1//vzaF7/4xdWNxku4DA0N1X3+859fWE9cvvGNb+zh+4ttKpNvDg4XaqNvfetbu/lWY5fS8z3C8Y9//ON39eyujafAl7/85Za6urpV+MLcemOjfrG4uLif6y5jam6jxxTjqWFiYuKA6NDQ0DAR7tff/va3m/no9l7Ff+pTnxqmL1eUB/jLO3369J1HHnlkWWXb60tf+tIuLjMO4/C16bLc9Y3VLN8MRb407d69u/HDH/7wWL5yvv/97+/i2637oN9EPhmkj7mWdLVwzc3NnRAQHq9x21Rf+6aTSRgvvv/9718RjrpmZmZ6YaSMw7pBXodM4Ab9SagwKPVx3T3z8/N7pqammru6uoSTcKv4pfJRVOq5Grg30Ll2oQw0gk8juDTQ4ddI8zr0W6w4MrkCoEcjbdOuVz6wO84tr1JCmnoGkkkP7vdIn0ngaRCqrFKuLIO4lHK2Ut6nnnpqP+Osl49GV3/ta18b/8QnPtG3XnRSvx4bGztFP9pFP646derUZWg3vZH0u3PnDnKj4VAOB/XTQL9eWFjQx7ZN/Msvv3yH+IoKPH95fX194tsBgcdHrXchQAw+3IVrAF/eM11qk2eeeeYB+sLEJz/5yeFCmb/5zW92wIeOwg+qyDsHDxLNYq/BwUHh2cZYPohi81qSclOywIstvcRADRQ66rFiwbS2tr5mBdz4+PhpCTdgXvvsZz+77sJYzJRGrkPLrKPh6vntol67Gfi7l5eXJVTqbT3p7OYR4dNJA99JK2SkyQomg6majllN/mo6Sg0duho6VlNOHbBr9aNc8yNebV9P+bUqlDRVKl+dS5fFhXs1aXoIum4ituEfFuWv0k73iV9k/dBEL5TLitFAR3AfKRKVkrI1NjYOfOhDHxopCQiZYWqyuA9bOPTN6fUSdhpztMcJCTuVj0J057HHHqu4sJPn6O7du8YisvX23xmXdeBmgmjfzqeffrrVHw+eu+24u3LlyhHi7yf2J8o9P/HEE/3rRc+Y4osKmpycPEn9msncTB9vwMIdyFeHGzdujB06dKiTNLunp6fFg67EFSz+B/8ydIfXDyUJO+XdlAJPjJuOYRhxXAULheG+MBo7QkMCxdSRgZyoHRSCFxfPgO4Fx3oG1TKdtxpCV9Nha+yduBre677+9a9L2FSBRxwYf9gSeWeAN4PQmnn00UdTu4YlRCnjpISWLiu0gGXe7V0vGnD60YlMnP8PfDXAlohbIM89WUuiG1ZfSZqdvww9QzsxQk/Qh+N5lwA3F4L5IOmN9WbDwnfS1Nv6gPcB0mtQJV1LaJcDSZHFhlNuLQMt83j6whe+sALuEcZGe0YbqFjkMuSTkpQheSSpxhyMTcJ6j42kX45Rn0W5qm1Y3H3Pnj0LaZW8uPw2DOX2MDzEuAah7Sr94y4CcJ+NL3RHOZ2xCnOhtP54CSz1P3+Y/1njzl7gtYe09jXu3pYv/sknn7xBprcAxkHYZGHUXwLuFGjV0yadGAINjJnr/GItWYXTn/rhnWfIu0/9J266gjhjhUL/xdu3b8syTrwCFCdjzV/91V/lY0QRQEheMX0Trmf5fSOJ8gQ89NBDK2HfMYx/jkEy4M+mCquTUKlJBs8MBNtLur2ETREXdmEZAspFKBikXYbJlZVp58qv426sIXAwQgT8DNrgpfknfxUkaORWXQL/BZ7niTf3uIGOtRDIm+8Ff/80nUGwJGTXgGsGgp7BY5XyVhFeq3omTsqEGfzgPk3Zo9wXEbKLwFkmTcUHkcqnHE+o5asb6fIySeUljR9EEy/6xV6iOxGBvgVtBunD1dCpFpodVEbupp+FgSSlIX1vT09PprEj2C+99NJr3O6b1bnCmBqYYZAHcMxF5b2JptTPKAc8j+bqmjdPOJJ6hMdSOEns+49+9KM6FM2D4C2NPJAG2h4AbqIgsIlzdS7o6rLp4+4ItnbaqNPGQYMaLCsz5WLDUtzPkyazgox1N0fZmo5IusQrDR0YhxMoF4G5ccKaoZ3t78PwwMBYJK6JNEaQJxWwmcPlAUGAvYlC9AB1kTXbevDgQRkO13jntlaNgeC1nepCn9D4Fm/TVMsRlNkxfx3pVzXwr/0KI808Y7CDNF4SpmRm8FjM2oD7kir3hsTdg0Z/ykZmvdOYR/TLku/SpUuSyNJWvAtTV0wpIKAw7wFdJ4F3F8KN0LHlgtpLn5n53Oc+FztIsHSsljfjAS/DgwY3LgdDO3CaRrCqoxvBQoeUUFklfJUGWGFeTGbXUiWFiToLZbyepmo5898IPPCb++AHP+i5ebMI2TRlJaWh3LvQKzDY/Wlp410aEArjeRZ63jdd/Yl8z3R4WdHGqlOnLwA7IFwE5jOf+Yxx4TEYGxhgVuCZfuYrxjwmpfnKV75yADwzC7wwfL1jXYjZZma4smKouxF40GSS9izoVogrP20YtK7GNdVCG7UzjvfLM5M2b1w6zRfHhacN0wIZ0h5Nmz4pHQpHrMWRlN6Gw4fEZxJ5TQ4/I/Do3+P0u0mbV3cYdRc3I/CYcxwKGwLwQAmDLSvwVEdZ8BJ6KAen6Deas2xFyB2nL/URrf4j70/gIs68M760HiMQT34vLfGiTYA+yAcpjvECz8u5DR40GGFCxm0gQvD8K7ZavBthBVM4SLg6WeBCWE0ywd4fCPS9oMlqvsyE0GhDdNyCWvF6CRMfmpv2EVoEFJwwohrYtIFRnLgPxrkx/Hnk6qAdTiuMNr2DclHyHJQffppnFMXhnIJl5hLA51ZYQ7dwSNsEnkYr7ejoKIq5WljrfYdZ1bLSUIxqD3RvZZwZj45lPNxnqPeQ3IKFcNNiKWj2AHkapMXjOg9o74Xy++MR9k3gojkiK3QHaINxf5q4Z/CsxjN1lLxGCVS7vfe9701UxuJg+MPAQ0pPrOKjBWF2ugEe1CCc/Xn9+a5du9ZIvDxC3kV+0ct7L/Qg+LTFWxIhlEE40A9NKPcmBLLhizYZtPC8MKTdnRPYNjpwl4LPuJ4LBCa8yF1MP7rC+oozwJUQa3vhhRfGMCJmuru7YxU94O+ijWTNGQPCgs7ll2K8SHyAXkrDWAsoy4EK0vj3RkZG+iywNPcmLpAwZiiFj7BiM1WlLey9e/cGLDkbXuqdwaiFL6axRShwizR8UjiDJuiLDCEDXK8jnDhxIraBbBbK0KIVo9WRb6EQ87b5Ct1lZaJV55urigXBgKmnfiYO3HYxKMxAj02cECgXas6qTEix84K1bJpBvICFaBctTKHxx44FNHmrpS6Ftfgw5exy63B43Dtt20ibmij6eyvLzlNNL2jOuBCz0hJ2tOWj1K/J1388NOAB07gOh9L2b+Zn6mBuJ8CzAWa1Bu+5KkboAczwYBf5AMsIO+D1U5/RQiA0NlF4jzEuzRhAOIyhvN4ulC9fPLRR29o+EEjqF1bQ8oilYyBR7oU6nA7H+/PH5QmHkf8Uinms8FVa2szLAi16rRJvA8HRPmra5lA43ou8/6A1B78MhSW+qq3hPZfhI5qf8y8qOq9Mahs/j4GHnuZdHshRxtqgBQyMd4Gb2v0GC3k8j4bGTZziEhB4MjfJGNCyKNhwRwqL1USRzKvIOCPw5C/92Mc+NmGR8d9xpbXSIZf8/lR/fPhZDJ2lsnJRmIvGNkKGQdUoWHRO84683a13m449gXdFTPDtAHc16j3KDdSJuEOqF/e4+b8qfMV5hbBPUyvIsJijoT1qjgk/6iA8ClqDti757izDFeM5lS9NoThoKSvDWBqF0vrjqdP/8f7WaPFHluH52LFjU7S9WbRz9uzZvAqFipPSceHChWt6Pn78uCdkGAz1ML7Ui3+Uv8TLU7/pc+qfHi5+uPS9Jvqecdf6w+Oeh4eHG+nrR+Li8oVRRrufYeVLC3wxkFhcbb7HH398DkGtMWODzNiiD02SfxJmM0eZ1Tdv3qxJWoRgM+asxFP0X2n3VYynfsZswXa2+e1dYxh32DHGeBuwRE/NX/fR5gUtO+H67LPPSthZF+OUVj4i8Cz4ou7ANW0LnbRYJmBdgKOIZwSQ4pTGXwjvZgW1wqiL15f8abbTs8YmfeGC+LWtF2tA9sLDDyLg1B9u2PAsd2A23Lp16xz9dR46XvHzgIDA8wOl09YwodgF0+ikEaUteVLVny7Ns2BR8DEGRh1IzLGA5EKhfDm34UmbTh1aF7i0A8fMU+idZ3VY02n1znWeCmuy0whLyr1NRw4IYbS6bgaGrL4Z5guH72dL/8+cnVk+TAfNyyTSQ9yZKSWQaJ/9MJmAC1KaGW24hqvpIHuXPP97EpXk/qEtjHvolVdeuav+1tvbe5B2Uv+9TYcvSWtPKjccrpW1DNQ1MTaUJsPMw2n0Tr9rpN56zNR/qKMm7z3mIAD+SwyTeGPVFUoLDtq6koijH66egbeGS6sfpbab+k0xzzWVU5CNNk6Sdrwq3SwjX4T+V/gFmLmFp7bxLU8XXGnsAYXUps1311w0vOQk+Y3iCz3XsECuMZ4D82JxMKCRFkccJ85YYtBCm8Cvq45x6dOGAVcC2OADzNtMiwz582Ic7Ld7llHUr4SVf+rTRXpj/bMR/EIh698PO98z7TxNu0VWLxK+D5wNLwXfG9Q/oByioDfS1ocEG9oOQePIWESp6iBvYN4sHy7hOL+wUxywKMbM7bUwdkcZu5nGiGCwz/qw2oIxuMpWtECd8gm8VZb37kWDqwOBLhhQ6n1hKtR/HT169ADENWVBuGl/XKFnygb3tXmZ07kBusRdmlM9xNEqSaMZ8uwNXhhlZw7uEsx0kkoXKiZrvGGuENSUnTVzOdJfwd/NxtDXC8FCg22CdpoUVgeYQEEYxS3wgPJB2zto17N07ON6h4YjdJaA8FF4+GIgxzKzcLp87/SnRuaCToFfAwO9GYu13zJJ4mrB4xQ4N9KWbX/xF3/x5p//+Z8n0po66TSPbpV37ty5OwieFRhPgwQPQYdgjmswtADzyYeb4oB3hAFnmI8/LYrUWyaOP4JnMUzmHxcpd5c8EaFo80rdtDDGjrtMgxn4/dA+0UMAvlq0ckoFMS5uwiw8F08YF9LKtf2OcHi+99yijCvhNKo38DSHpsVGu/wr7/xp5YlBCTmsNArnPjUwMHDTnybNM23bRv2Okf++Fnw/k1Z2t9CXPK9QEixwbaSvGyYNDPXlJWD2kDc2C+NEC5gSaWkzwS811swr8CPtRN29PnHkyJG3/IUWQIXu1HGB/h9RBKivaQcVS5q7pAl4tthXuIq722DFfOscfDQCA1oWLeziqqs+xhgaY/wdACeNv0tx6ZLCZCHSN4zXqr29PWIh2oEXmx/G2A8zPCfGwSDtIdH12IR5AhkE8pN3UQHjcgBmRNPIk12+Y20pkNVWCw6/SqfWIpGR5557rgcG3on1dl75abx3WzhoHavqeOQdhWglaW0Wpr3nVmiaXi1hYcPX+54TDnkHjTRKOqwRdtBiRvOzuAsboKFBl4G8Iu2aORBNBh/l14nmWSMmZIVPXL04aiwuOGvYCn3DWittMIAGaHv1xz/+8aosANrNMAfS3Mkn7OIKVZtz9WFtUe0aub97qOMK7vasfS9RuMWVqzA06TnoKEZiNP1wOhiHUZZy4ZkEXhjWZnpnXvcmLsIaaH1ANNfcGPj1CUcpN9qbR5xZRCYlljSDCO9hxWe56JfyFh2kjY2wA84M79zub2hOAwth5CWjn6jvWwXZC/c/MM7FQwoKPLb4NFk3MuPuBMLAD0aWsMdvmX8/GxMvl6bJExcfAMaL6g5vzMyTw3Aq+U4dm1D+YtcaiP/QB8bD5VOvQWjVCi32oETsR9AGPHTh9PadPDrR54jeaeORODe5X0Oy+by7JD5I2U7ZJuS9yJQPDIJ9CDujSVCRCesGSZm9qGRoCTf37dt3kQGWicGlKcy/UARf86ZkWNoLicZ6Su4TDWjacJZ5rqtJQiwnCAZUf9K3Hz58+BxtbSby09CkmDTqB1ioF8HNaI3cWy5fvnxG1oE6umDSb8YYEAVd6aTzBBNWo1FwgLHGJtTr1Mdo2ihHR3C5Gbgp8R1n0NwI/ygrLz4wPLM6kXLNqrJwWdTTjqElrIaAuyWcdiu9i94f+chH+m17QqcD9KGj9MNjKKrnbJsyJqWkvQmjtnwlUzXVh+mfsjKXUMYH6buXgG3oSNlr/BaTfgi2+5oemfWclM6GZ0KMxLS9x9jhdfIwBH70CY/fhuP0Tj08SRwXHw4DTw9eVlzXMf0+aC1lOvIDB+MuDeOicUH6W9BDW7xiFcdwHr2j4OokG1mpS7jcb8Wl8TSOuEiFHThwYAjtrEONwS+ziUmjdAkOd/nYb+u5mIvl27IypdWkcqfBUA3jKaasAnk8hrUewrsALoFouctwBXbB3LVgxwgB6K5l+jdpOyMIAhl8L2JACIQ58mrlnE5uOQWzmmIQD+VcWb7U5XmEfrLyrrEC8BDMqxsczZFrgs7zlBhoIbyVVgKP/HoMXGKOMF3NzZylPnLhiSFFXE2BTLkXGPMsNIkoTDmXpLwdsRdleP3ur//6r2WlBrwA1Nf0H3DKrCyRpxV3j2AmXX7msI+0RtFMSOwx14T4zMFqK+hzi3EqOoveZuGYBQRNx+AnN9XuNqyYu+Z4advX1b70zSr6qQGDJTGPADyfBJO+0E7cMcXDUK8W6tfAfSftlVqoMNYGWG0aUYhwZdbz02Zr0XyJPWiXEdoRGhDeDoyDwo/7BWB5Alph9iJdL/EtjNPYeJtuK9/x3N1hcdxYlr6SUyCl2NcxdiP0FT0KCjwVSEfRyd2H+O3ReXFpz6XLLWU2PnU6452wjzhLg7D6ywxemFteN55gYtZ20VETLRTizGCn07ejFcT6oHFjDIYnlXP4GoalzsaAiF1+7K8Xrg3P+qBcWV4F8/jzQ/Oljxc4/V/7Y1AmOmA0BjaMRpbaCvcbdIJxfn6Qic8qh7Y+D12OU7+9oiFw90HPOfAYZguJFirEdqREoAUigKv5Hx2pJo3b9EfK11c3zOkLBbKbaISdR2Mm+wOCXYOAfniV9qwGd08YpYFbTBqUi3so2tTHywAAHhpJREFUDpp41pyp+qAn8BSGq8+49ah3ZoEHXbQ/MRVaEjbqB5W4qEc1zKhehyFzbm09StZu+otOCWmmD4YRXKIPjdG2YzAhM0eEUNQc7THgzOMGHC6mT0nYZa0bOEiRM9nS8JGs8NXXwnk0NilLB2gbnsOUTh90iJ2PZpx5Y4t+vBi3aEW0h4cYXkh/iGp5YQQ2+B2hPYLXRYsevYu+orYP8Gf1Cfblvd0mgieYR8aLuZPeuHsZU52ESXExF3Q1Y5++10u4N/ZtPiVimqEf2WM8SeHOeR9K6F9Io1WIAd7hZI67CLxQivhXNDpj3ZFvpbe393Z8qnShMDXTyDqGq1AOytVp+4nuK4hjQICXmWSPg2c7aEycEXh0NmnavTHxgSC/5YHQb6HMgpPqfgDgKiZ90R+mZ61SYwDrdHD9DG0UTtialAsOXr0NU8isAeYG7WUpNjClw3RO1VMLEnrlLqQjThE2Eed7V/lZLhajNDJneBha7wVvLyt1FnPwOq8iECKx7g/FkddraxbzdEvgKNxeDBJtNRGMvfQfudVjGY5NX8od3NdgSLIitQJOCojnWqH8Vvql4biyILOWI0UAWiW2KbC1iMtYgLTRPcpITAtugLp/Ok0WPGThoiS+nbzVCLIqbbvlWQqW+VlY0EH9ZBQrfUo0seHKD2M7letXWk2tvnvdxlfyDuPbBX3MGEExWaavV6w4Kfsou1rR2moLoZ/eSmss2Dy6M9a7pdQBS18b0Kb/eoVD/wndN/OVU2Y8QS5cmU/Xlo0I2vSJgvJI/ZZ0EU1OPIMrAlMBlOWl9wrA/dEJo4x1l7BSTvmknel0hT0MaL2bi0l4CQ373EGcsZhgMFr2bFbLELl09erVHn+++7nv/5Nuls4X0AL88XomzS4qtAoBC2o1dAgJiftIhQGlfKczRbQ1mL3cNPeXYaWEU6lk0ENWrKfpqBzoMwHPu4U2YzTpuLL7+/uXmc+7qTgGUaKVoYEJ/AsMXK2I6+KnJcqiqQaw7pHJZsJSXblN84eA12Ez0IdWcZ+OQvdO0ThneXsLBWAWB23aAvcuv/AMp6UvizYVE3gqD/fVBLxVAm+XNHzrOqN9DuRkkI6am87KcBmfN/NZ+/RPb5Um428Q+B79wnRQXybsHeHwQu8af1giYrTGmwCttUPYHDZOfef1o69oVaMZP/RFDyTCrgVhdxI6GL5DXx2T2xqLx0tTyQfwMooh5S+CsyeEy1Em9dY5xC200R5+++nLnjUJ/CVZdsUIO+HGOG1mTBjByV3ufp2NO2gt5nLgv9EwWFm9ypjvrwQeLIjzlEtP4NFIxoWVtUCI72XhWR/utAsO/OE61NY/v+DF6QEmJyB5BR5pWuhEAeuODlwtUzinRXgwc8IzLzwvcYYHmNQKjXIhQxbtE6wB9zPKA32mwNnT+NPA4TDUqCpExpMnTw5evHixlQEA2OpRFuloVVJBZSBn9Y2kKRu4Ygpj+lm3KQxuP4P3dpr8cWkk7FicIgvBU8dgfNN4EG7oQ7MwU1nAsqIlzD2GTf+JpYPKAE8PFs+gaL76oKjIRVkB6y+SIBdAm9XFHYSOG6+euKRsJryzs3NS1rDaBsF3gMAZWTZYM0YZpE+M5WibF07WSPoWRd5XZllQVVaG7scFy+UWdJykH9xDYC0Uqou8ETDtHuqvwycMKNrzLu2kFcItKNF+8IFn5uRmCsEPZMjzQplGOafcguMkD5jYKOpwAnoYNx3lmDTgvYBgGmHeMtVcFHiN0zcMc37Pe97j9Xf6m+YFx6ChTqRZRDiI5qn6sRChrRpl0BikfH+UJ2vRhPDcRpqARwBjxvtcEeVpTthYlj4QBjZ5/UFFPefauOw8O4yMJ/BomGUqn6UjyNoRdzEDW4DtsxqDwRcgXrhg/zuNnDetrEqS7KXh/YxahwRXw1jO4a/1Oocfbrmfc50s0SqKK08CmYFuokRjtlRkyh8HU2Hy7wP7kr/zY0FL6z6WlCdLOFsTfuGfJ8lZKWLcN8IKRha4whs8J2AK7fzmUbQGP+rbI0QfukO7HuPXKiFhhTjKxv8llYMS8jbaxihUMNTIht+kfPnCweMgDCytVRkAJfrI9UtgK3D2Q8ebMA9jESkh/aAiAxshVwNTNLgwVkrnQgZS9E+KCaFG+aTtoglyIVIYaN+DjF1tVQiko710/qnnig5E+l5o21/yGvG2+JJ4j5Sj7+BFmLISQI9a4o20RQAsJ6XzgGV8YMM9ywxu6ustsnanVWd4oL5Q0o5V2+6fU0oCLUFpFQLwq7J5/Ho+/E7C7moSjLhw6Kx5RCmSiZf6O2kS44mT4qZf4CJf4H2zv3g1hBH3pUVWGhuNeZafLJhbdKaeXN7bIhwNskYjXcoNjLRgE9NRRg8EX9a8lE2E22iazqF5Ag0a78OKNn6r3TUArRsoLe4w1oBrDuai1YpBzpIWmC8dA2+F77Stwah9ofcfSxF2FhjCdLC3t1ef7RhXX7Hhubtn1TG4NcC8Ng+lM6+5fZGe94C+sp+Iobi06xnGmBgDF+0lqn3ggQf2IfC0kVbzXHeLHReqGxawmUOOqwvj0VsWjyWqtN57OD0CSEdahINLfs9Zc/ulsAAsEde0BYUXIeXLB321yjfWTQvtvKzQSfipn+S9JIDSXrnTgX5hxwfCqg3eFDtFlBZmXDrqUfL4joO72cJQdH6VdnrLfZgRQdpXUwYRxcATeGnh0Ql0GPJxANYghG6z32FBE9e6eJ5nocNtOt0htOMTMMyL/EodVbIk62loncTh9dqccLhi8WZwv9s+6y7LCiZzwh+W5hmBsQDsG2nS5mhxBvy0+XU4q8BSGbJixsbGDvHYxkKRK8X6+QULms+Bh9wf3gWO3sn8xEk5SRzF1F3zapp7naQNE9N5wIt8yLXjGJveAxByc3snbSACvCDD0L5IcLZZdG+SZVGsUPEBGsYdGVkUgDtPnyI65UsX+4irbwqmJ21/F3l6oOcuJcQKi2x1iAUQE0i53pxnTLTmub1g2jniwvIieSiHsJOShmLbSDvJ9SVhI0+M5wZTeZQzS7xcuHe7uroK9ilO3DFjQXnJMxq3UlFxm/Gyws6PG0LvHmNw0h9WzDMwAovTssAQHVEyb4bz6NtxhB1WOO10gX2rgbl/9sTusX0dGNeBEakH2yuOgFtgLUG4nGLeKa+WsVNMVpOHsRBgChZQZogIO608kua4hH996MUXXzR+awsQ19MQwqcNhJsgmIiZSnjY/DF3fQlcbqoxBEpMdHyQvnpOg5o5k/gU8aHULbXLEVerNEXRopnGkWDPND8nDFAS5JbV4bfVKA7qPOehXUHGoLzhK2fxBaw+5kiOKB0dehH6JVpLMC8dRm0sdVYyjodhV/pdp5uzsOkBcDCCQeXh+ss/WUYathu0WDee6kj+BgS/rIthwSj2gnEvsijAm+y2cKSgWBe1DYu7qw2h/TADT5+eMXXiefkDH/jAJCud47LEhjG3uUodA4woNiGBKkf9CDqYhSRJ6cLh9F1PkQzHxb1jxbXSNsfFlKB1JAk4LOOBGWfv7GiuT0bSxAUAt5tw4/qF/gvsxbrJuI9LGggDj2GEakQ5sYnE/NQOepcA4qdPOQnxrlzYCGGJ4566BMaU8qS9KPce/SiRL2jcab8dUxNL+cY9ylMzOHpjI235SgcO8tZEDA/4tAcGBWk1nAYFfA1lzaSBXrEwwF9TWh6cCjwM0z9TTwGAp4yxRM9GJoHHAO6AeNLAxIy0mXmV46sCdVSjsbKvD0LJ8ulAKCyzsiyxwQOZE14QrHf4JcQWDgYPTXwv5UtJfWQpFGSwFgbMpZq6GVrwvKL9RDYuy12uEODoYFa5gndzMo0GYdlccjAOzSto6bhWriZedCrNN8lFrRVgi3ELNv7sz/5MgzIycBKBpoxAiLTgrj7JgDb9EXrepRxpl3nbgwGqOSszrwDuxpIQYyOvNjyPcC9KcUiJdsFk1Gmsu7v7kK0X98yLVbBUpynoDRUmr0WcFaE49UcY2K/wqHmqKRTPiDtH6cpxyXpF8Z2HvoaxqP+L/rxrP6W+mJJ5oQm4d9H3jMIFrDUsYR0YkKqv5Vu5qvpqwQZ4marTt0fAb0zbbuBRRuAh0GbSHl9VDvpZGLKQ6eNnpUBBzzuEl2ocWNDb5k67LTNPnErhU6WhY94+k1rg5YTdUQGlQ97K10G0YZsz0K7TmCdIe5DOXIOWM6C8WS86fS0dw5SbNa9NDx7DEC1ijtt43RkU0gwik7L+NP5ntFEtujAaF/eiNs9aeAzAIRpKE/v6IONBGNs4jG3Rxhd714CCfnYxR16BR7n7SatVVzoP8W1xmjs4yoXszbEVi5fNl7OWtHpP8x1i2ivsy7sGA9KcrOZm67mDVrzgYh5wPwLPLFKQ2wwBM4FXQd8Z26X2Ib+YSMUv4ciS9IY4Nyq4yHoy44x6JFoRhZCUVYW1d4z7nF3R6s/D+GwBvlmUwZi7648r97PaAzz6aKe91G8G4XrP30Yofw3g00Xb7Dlz5sylQm7JHG+RN0i8xXz1IOHQh8xVkeJG3zKKKbAXcdutu/ciCWnGnLdKkv5btBWZBN+FRymQSuBJ+6JxTIeEGab6SKIEIkLkJgxULjV9pqWGgVHwiKswijATxlT+uYtwnkq/y7KQYFI5YmjaElBKmTALfZliAFjm7EsEgDTd66XAVF4GUTd4GjCUkcgEYV67aVdv4UdSubRlXu0pKV84XJYKTLsLV67c42ZiWswI184VucBy2rfJphM9eIgV/swf6TgyzfWs4hoep11WYJ6T1Hm/2oe+I4uqLDiH66B3GGkrSkArFnozglr0lULgXXLpU75HV/A5DI7T/CQEU1/qb7SPFlnoyyV7Kesc9RxAifMOR1c8tDQwsVwS2zp1oQUS5rRuo3mHpxoQhK3Qv1NKDHOsp8D/Er9IO6he7JFSH/VWw9KO13H55lVOC6DmRQs+itsJAowiwP1GHB5ehjwPUmq4yuoxYHx6rjfgp7Zi8qC5ZaPEg+jbbVjrAW8g/bpRB0inrRg8SocvJCbPK/ByiwiOkVtzItL+p/Gpp/5Ior5qgLCUW6qLwdgBc2iC2V3LYr2IYfEr6C6EWN6gEa6VvJib0IIAY1lQr5KsO4unFAToY1x5hLXhFh4pRcuFCe8R0xF86DeaY1C2uMAdTVw9JMCsbQLo6n16h7rmdQvbPIXuMORu4ErYmaTCj9V4g9YSIM7rsTDPWIGnLRgwCSNMYBzag2jy4LIaAq4GSD30lMvqdiF88sVrDOh7e+CkFYdNnCtrPvCpPOBtltWDh54DYBjA+kqDWWRCnDlqjAT1zCsf4Z5Jmckx6evUeQo85O2opW2PolC2MffZx3sVS+LNwgHiZ7N+XUL5y3nRb0cQyDrVRIcINPN5sOPQSC5KT2CIPsQfBl/jJRGNEE59CLvEubgsOFKejuAS77IrRXXE3lQWGP60OgSf/tSDEJ/Q9IXtb/40WZ9FG+pvFDbaLzJfnBXeVk2PTGhk64a+aC6lKCDweG9jfHtbegrVkT6VN0miwBPD5JgmnQFnGLsaGt99n7/T5oWci5Qrk87N2F/uUQPDMM7x3gcDTqXF0XH1CYkwESJFI1jXReCpcbBMjIsE4i6D2wh1ieBTTADnEt7EujunvDB6WXmXioEDjrXgKBetsUA5WWUwHxwYgQRZLDNgw7m3KoF5lbIIPBjbEPXTQp1lVkLeCAt2+oi3GALh6DFJWwfq10AazdVpQn5Z8GwcdZmD0Y3SbyQA5B6+C3PK685V3pxyp9NkDCj6ewdeiS7GgBQ271KZ/ot09xCyM1ibXn/O4XfcpmXRyVWUinZwlSBuQ2PVNxozM3b62jg4acP2ccrVtypb9GVnxtYC7wYx2qjgWPHjX6lnxsQAAkJfC5Bg20+byEoXL9gNrfSpIG9BGW01jzJ9FWFXFitHbYnAPUl5Zu+Z2gj3981S6ko9dJajrJCDQ0NDY8DKz1kLFEYfaWGs271x+mhxxAIuAGJbROsINsbyA7SRscLVdlbxVQXVN6D9QtrK0kZSIhLlWiRCBV6/fv0gndRYByoIALcQXLeLXThC5x9ShwemmLA2gJ4UUzrJaSH+yqWt1Ealg/g1CNYT1MEwFwapWbhTLnxgzPdgaJPAN9+CktKBiZ/JPSVmy0A6CQzDqKF1STTGfSZ3pxEs5dBqRSvBAc+LSSvToKt1QSl5QMjSBtUws146tknD6rJbYbzoZ7fos23AqdFRVpR1gTSxblENOITvAwi2Wmim8swl5sbPvpo7cJcJWyCdcUUhrG/KmvEnkhttdHS0F2Fk8CPtbW01YVzNUYYYXD35joLTbBJOfnjh55xychkadFBH82VneIVRSqDNCm0vaxI037KmwjDW413lc8kqPUN5srI0rbELwb8PfD3Ckm4UQV62cUQZTaz21dSAsRyh0eypU6eulMpngGMUf9GOPhXokwoLX9QxoqjZNLR9LUfcHbfvpDWrEKFVG/154fHHH9dh7YH89GXRU270QLiFsRXv0LROY4+6SpnQp4Cuh9uJcTQm+ZG2fihZshSN5yUujzfCNVA1V6djn6ywExIQ+iqDrCS3kAqWdsoczSUazWhG3NtVllZQ8ewNgDgkN0sYAugINDFuNBqnLAcox9TNozWCpicmPjFIc1/MjZ0lgXHjgOso86bSRou+6AtGC4VJF73gIq5wMXvwix28hHvMBfwD810w+oMMFIMT/UZfaTbMwl+GhAJ431AY7VQnBUD925/GPmvJP+X5BaxxMRGvL2iLdgNYmZcp85csk/8Fffiazcs+T/to7uBTw6rMk7K8FCD8UBJNe2ogy2WncA109queEuPTezEX43IOYRrQfFUPGOYZmP47tAhLcx+llFEMXjaPxrQ+jwQNtcrUXOBrjsLTC/hPQ4cL8IV+8C7ZupGiTr2PUsZZyjbCTvSnvS6Hmeh9bN76Zw7+rZfkJzPupfSkscYwEH7J72f8rvtBii7su9X2I4MjcXP04UmNXcJ6sX4fhA//Cv1cH5Bt52fGAnS6IniMB7Ni1w9zqz3TJ4yhpf6qH/hrvF4UHSpdF1OwiI2kNfuFQMCUSceZ4dcPEmVxMwgoTE5HU53HhJW7Z48qS8c/QgN3aCtD2LWlPGIOxPfqudgLYu4DfsA1FYYFUzMdOhxu38U86JBmnoSwJVwkhqHa+Dz3TEwt55KboiwdBNxMh99HWKy70ZYJTWXVdVIHs8xa4dBVR3YNMVBsssx3ytZXEszApB2C3D0ztPQZqLfR0MRc6COeUMQd1s1gMa5r8Flk3u+aP95fwp/+6Z+O0W9k+Ygm2hN6mvpIeQto5/TJFdINU+YqzOYeQinV+ZD+svQswQKT0lcAjLAjaAnaBeatZOmRZoR6dfJrRDnRgo7LaRioyiBdDed06pNNB8DV49KUadyq0EL7X3k12zsOkOUAru016HaX8T2F63UqbiWpYJd6qf6UpfneZuqm8zGbqb8OpwiA5n0ahWC4lAMW/ABFE+YID6A8a8rEjDX6hvrMbYTDUFL/gIarjBcDiv2vstgTXcwqg35nXLCUcT+TH4kUz9CiWvOA9MFD0MCzyJnG6FN2cNZ5w1K+5FnQHK13Ggx78O5Bs0kUrLFi2o/ykk7d8RRL+sZJxkFA8aB/epu/oVcP8d3hqkKPBnAPBye+i6dQP78FpsMyroTHZSKAEiNMb8RE1ykdhrFRAdp2eRBtIqI5l1iWyS7Nnoa9jPbXQYfTp2F0soeW48f6xBVPxtSTlnE4Ul47DCIuygujHO857oFO02HDaaD+sNaoDv3yyy/X/vjHP/Y2cBJWg5vCcw0DI2CtWHjhO53rtmVo4KX5wliBB5NpZBBotaPZuC444LYGw9Mcaarl1xrM586dq8a9KCZhhMuTTz5ZjRuohfbxLEz6RNm1L9GMyxNowl9uXMKl7Upoe2UyUHQmo2hh6sjtargNFOe/EPaDwBMjMcoDtHkQmpmVoP509PUB/zu0878WfJZ1gbvyARIay5q7+cgni0cCwlWAgD0A45ObWJ9EakEQ94JfRHATZr45hwtwN22sTceamzBbD0QbXWprfsOcTnKbdlS/G+DkC+2nbLdMReNHZUFL/Y5Aj2WY2xLPmmKQm3cJK3cR+Ape1DytlABTgO9Prl/6pLauiBnX6U455i4Bi8JFUTXCSRayrFsvN2EqZxRrS4co67nki3ZsgCG3g7P2BgsPAxMctBewHzrPw0TzlePhAX6dMHPtiYswCWDpuD4pD0Y4UFYqxY/+Wg8ttdhJbd2C0NoHLH3axuAEvgt4Ta5DDyNAc67xEW2jYKWq+oa+FK5tH9JgBAcW3XgQxXsGuKM8T8a1U1yFySs+H9Q8QgnBJ6Lwg6+Xiva0FqkXpgdgB96zvJB3EqVESmEiEGjXIyUhLVxg3e8ICRlMjbS5FS1wDC2w6sEHHxwoxEgSYKUOBieNhhHKnKYzHWfADamDxgEQMWj4obg4fxgdI5EoEFaM4a0R6M+Ye1bH0i8mygSxOOAKK+wOAacmzuKSkIB5vYM02gBs3GL4kwMwqUsqt6AsXQSlVuTp5IxhMb8czTz0xIBgMg8qgDQmHDpNk24QRp+qHGUSgwROL+UZGPqjDlVW+9U7eExS59QwlSfN9Zd/+Ze7odU56rcC3mpnnRLijTLezT46ub2po2lfpWPAX8VCKIiPaIYQuCahQn650/QtttOU95rgpMExTZrr168fJZ11I+uovcsIuwjzFCzhBLO+Bh5nxMiEF+NAngNTV30jkPrpa/OeR4I0RoCQVyB0LRE2Cq3usBLaE6oSesRJ0RmXQEAR0sKWvRJ45LXWT50EFDTwFugwBgXTXPSFqueee26IY98GbZjutIWEoD5J5fU3y7wV5r/AjSKXZyhb/VFu59ix7c+T5RnaHKNu2rcqYWCyUs4CKMqjkWpzvwQv49MecCDCtkHPCBp+2iiSLx9EFEnqr+MWT4CPrB31XwnPav8YssKD+EWex7T3FpwjBeYsOPWFO7RnzbFjx/ZK4AKvVeVDU50s1IKgX2VcTOBm7wdOsAGU0HepTOhUlGXqAxP7CM3Vj7y+GpvIFyg+gtKloxhnEXaDhXBXVtHSB6KkR4+5sAKzIOFKKikmc24gvBkT5QXRmVYg0m0vIOEBxpko8LCYrlGWZy3EgdCcB4SVJhd75ZjJQGwkgYoHB3Uqw/jAG3BvWY10DB1mqnm/JBCBcBb09L2HT4SoQ8TlkVBE8zELXCjrLgPglv3uWgBQgZeBgYFpCbi4i7INA6Vj3gT3uCQlhWn5PMxLgkHaI2PyPvPKAdXZpEaoQccJBkgX+NQy2K9Aj4KrLi1iahfocw2hcpg26ESrVj+PMBqbvpg7GvkAgkIf99WJIzo03RNCcfCkmcvSlMIiZoSF5s2ziia0q/IHmIgYBIxS82GaFyx4kokYOmnlpdGKVc2nNSGEmugn+jhyoxiV6El85FJZ4UCN1ZyCqhNwllVX/WgzfWUF429hgeX684y1+aTFSGGYxb7TB+QWNdMLwpW6DCP4zfmvWfop+F/np9W+ZnolCR/K0GC+x10LpCKCg/z66K9oIqUqAIYwKQpz9LtZrLIpaKMTadZYjBZIF/eS4zniW5OyGLmrzu2U0QBcbjWrghWXNxQ2xZi5EQoryyt4HQWQ5/1KA5RV48Y7g2elYHL60xDjJLW3EWXxOO1kpxUi8D2Bl5JwEQB0PHVyY4HpOZKgyAD2ui2iIWn5eirmZHFA8zNuQ077X2WAjqh4iBCrbftRA/dpOhBjx7h5/FGpnzUgYCrGP28z0cnFGOZp3LtoYza44D2NlY2L6CZunZGsKzn9hTOo9KmUK9Rb7hZZT7KGV1hpuMpKsgUNujiB64dRyvPevXv7aLPd0N9ocfRDuQPv+ecqYGJL7De7xF6lWoR6QcsujE+ub99EyGQ62zEMR++c0bqKVWwGIH3OMD8JFyyzy+985zuX0rSb4CgP+Fymny9Rv0Afp10HoIn2Uc63t7fPU6ZpB+XTlYZZ3k95/z9XfwmxgCDLMVEx0nq8LHUIkjr6bx2LOO7689tnlOIrxfIJC6Mcd23pAPd+cJ23Sh5hmUGrX5HpqjIyRqvlpYkDoi+HFKo3nwcaon/qlBid57oEbou4ohf9/TgOdtqwHK63wVOnMsnluR9rM2CFh2GR5g7tWsM90O7hdKW8U1/DN9PyaZWVZoxAbzPG4EmZvi6C0SHFZ57V5RHFpJR6uryOAo4CjgKOAo4CjgKOAo4CjgKOAo4CjgKbjQL/H0U4I+33KKiUAAAAAElFTkSuQmCC",bgImg=new Image;bgImg.src=bg;async function imgToCanvas(B){const R=document.createElement("img");R.src=B,R.setAttribute("crossOrigin","anonymous"),await new Promise(D=>R.onload=D);const F=document.createElement("canvas");return F.width=R.width,F.height=R.height,F.getContext("2d").drawImage(R,0,0),F}function addWatermark(B,R){const G=Math.max(B.width,B.height),U=Math.floor(G/600)*5,W=Math.floor(G/500)*5,q=B.getContext("2d");q.rotate(-30*Math.PI/180),console.log(q);for(let Y=0;Ynew Promise(D=>{this.canvas.toBlob(D)}),this.canvas}});const preset=index.offscreen();function blobToBase64(B){return new Promise((R,F)=>{const D=new FileReader;D.onloadend=()=>R(D.result),D.readAsDataURL(B)})}async function svgtopng(B,R,F){const D=new OffscreenCanvas(R,F),G=D.getContext("2d"),U=await Canvg.fromString(G,B,preset);U.resize(R*2,F*2,"xMidYMid meet"),await U.start();const W=await D.convertToBlob();return await blobToBase64(W)}const feedback="_feedback_1x8ma_1",title$1="_title_1x8ma_7",wrap$1="_wrap_1x8ma_14",sub="_sub_1x8ma_17",group="_group_1x8ma_23",text="_text_1x8ma_51",submit="_submit_1x8ma_72";var styles$5={feedback,title:title$1,wrap:wrap$1,sub,group,text,submit},bgSubmit="/orchestra-music-score/assets/submit.a571df10.png",BackIcon="/orchestra-music-score/assets/back.0e8784e6.svg",__glob_10_1="/orchestra-music-score/assets/setting.39685e69.svg";const header="_header_1l0s0_1",left="_left_1l0s0_10";var styles$4={header,left};function getImageUrl(B){return new URL({"./icons/back.svg":BackIcon,"./icons/setting.svg":__glob_10_1}[`./icons/${B}.svg`],self.location).href}const settingPopup$1=ref(null),suggestPopup$1=ref(null);defineComponent({name:"ColexiuHeader",setup(){const[B]=useMenu();return()=>createVNode("div",{class:[styles$4.header,B.value?"animate__animated animate__fadeInDown":"animate__animated animate__fadeOutUp"]},[createVNode("div",{class:styles$4.left},[createVNode(Button,{icon:getImageUrl("back"),onClick:()=>postMessage({api:"back"})},null)]),createVNode(Button,{icon:getImageUrl("setting"),onClick:()=>{var R;console.log(settingPopup$1.value),(R=settingPopup$1.value)==null||R.onShow()},disabled:state.evaluatingStatus},null),createVNode(Popups,{ref:settingPopup$1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Setting,null,null)]}),createVNode(Popups,{ref:suggestPopup$1,overlay:!1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Feedback,null,null)]})])}});function _isSlot$1(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}var Feedback=defineComponent({name:"ColexiuFeedBack",setup(){const B=ref("\u8BC6\u522B\u4E0D\u51C6"),R=ref(""),F=ref(!1),D=[{name:"\u8BC6\u522B\u4E0D\u51C6"},{name:"\u65E0\u6CD5\u8BC4\u6D4B"},{name:"\u4E0D\u51FA\u8BC4\u6D4B\u7ED3\u679C"},{name:"\u66F2\u8C31\u4E0D\u4E00\u81F4"},{name:"\u6307\u6CD5\u9519\u8BEF"},{name:"\u5176\u4ED6"}],G=()=>{var U;try{if(!R.value)return Toast("\u8BF7\u5148\u586B\u5199\u610F\u89C1\u53CD\u9988");F.value=!0,request.post("/sysParamConfig/add",{data:{content:R.value+"#"+B.value,type:"SMART_PRACTICE"}}),(U=suggestPopup$1.value)==null||U.close(),Toast("\u610F\u89C1\u53CD\u9988\u5DF2\u63D0\u4EA4")}catch{}F.value=!1};return()=>{let U;return createVNode("div",{class:styles$5.feedback},[createVNode("div",{class:styles$5.title},[createTextVNode("\u610F\u89C1\u53CD\u9988")]),createVNode("div",{class:styles$5.wrap},[createVNode("div",{class:styles$5.sub},[createTextVNode("\u8BF7\u9009\u62E9\u95EE\u9898\u7C7B\u578B\u5907\u4EFD")]),createVNode(RadioGroup,{class:styles$5.group,modelValue:B.value,"onUpdate:modelValue":W=>B.value=W},{default:()=>[createVNode(Row,{gutter:4},_isSlot$1(U=D.map(W=>createVNode(Col,{span:8},{default:()=>[createVNode(Radio,{name:W.name},{default:()=>[W.name]})]})))?U:{default:()=>[U]})]}),createVNode(Field,{type:"textarea",class:styles$5.text,placeholder:"\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u60A8\u9047\u5230\u7684\u95EE\u9898\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u5C3D\u5FEB\u4E3A\u60A8\u89E3\u51B3\uFF01",maxlength:200,rows:"2",autosize:!0,"show-word-limit":!0,modelValue:R.value,"onUpdate:modelValue":W=>R.value=W},null),createVNode("div",{style:{display:"flex",justifyContent:"center"}},[createVNode(Button,{onClick:G,class:styles$5.submit},{default:()=>[createVNode("img",{style:{width:"100%"},src:bgSubmit,alt:"\u63D0\u4EA4"},null)]})])])])}}});const suggestPopup=ref(null),confirmShow$1=ref(!1),switchProps$2={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Seet=defineComponent({name:"ColexiuSettingSett",setup(){return()=>createVNode(Fragment,null,[createVNode("div",null,[createVNode(NoticeBar,{class:styles$7.noticebar,"left-icon":InfoIcon,background:"#FFF6E8",color:"var(--van-primary-color)",text:"\u5168\u5C40\u8BBE\u7F6E\u4F1A\u66F4\u6539\u6240\u6709\u4E50\u8C31\u7EC3\u4E60\u53CA\u8BC4\u6D4B"},null),createVNode("div",{class:styles$7.groupBox,style:{height:"auto"}},[createVNode(Cell,{center:!0,border:!1,title:"\u62A4\u773C\u6A21\u5F0F"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.eyeProtection,"onUpdate:modelValue":B=>state$4.sett.eyeProtection=B},switchProps$2),null)]}),createVNode(Divider,null,null)]),createVNode("div",{class:styles$7.btnsbar},[createVNode(Button,{class:styles$7.btn,icon:iconTv,onClick:()=>show.value=!0},{default:()=>[createTextVNode("\u6295\u5C4F\u5E2E\u52A9")]}),createVNode(Button,{class:styles$7.btn,icon:iconYijian,onClick:()=>{var B;(B=suggestPopup.value)==null||B.onShow()}},{default:()=>[createTextVNode("\u610F\u89C1\u53CD\u9988")]})])]),createVNode(Popups,{ref:suggestPopup,overlay:!1,style:{borderRadius:"8px"}},{default:()=>[createVNode(Feedback,null,null)]}),createVNode(Dialog.Component,{teleport:"body",class:styles$e.confirm,style:{overflow:"initial"},show:confirmShow$1.value,"onUpdate:show":B=>confirmShow$1.value=B,message:"\u8BBE\u7F6E\u6210\u529F\uFF0C\u662F\u5426\u7ACB\u5373\u91CD\u65B0\u52A0\u8F7D\uFF1F"},{title:()=>createVNode("img",{class:styles$e.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$e.footer},[createVNode("img",{src:iconCancel,onClick:()=>confirmShow$1.value=!1},null),createVNode("img",{src:iconConfirm,onClick:useReload},null)])})])}});ref(!1);const switchProps$1={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Practise=defineComponent({name:"ColexiuSettingPractise",setup(){return()=>createVNode("div",null,[createVNode("div",{class:styles$7.groupBox},[createVNode(Cell,{center:!0,border:!1,title:"\u5FAA\u73AF\u64AD\u653E"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.loop,"onUpdate:modelValue":B=>state$4.sett.loop=B},switchProps$1),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u663E\u793A\u6307\u6CD5"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.fingering,"onUpdate:modelValue":B=>state$4.sett.fingering=B},switchProps$1,{onChange:B=>{state$4.sett.fingering=B,event.emit("settingFingeringChange")}}),{default:()=>[createTextVNode("off")]})]})])])}});const switchProps={"active-color":"#2dc7aa","inactive-color":"#CCCCCC",size:"20px"};var Evaluat=defineComponent({name:"ColexiuSettingPractise",setup(){return()=>createVNode("div",null,[createVNode("div",{class:styles$7.groupBox},[createVNode(Cell,{center:!0,border:!1,title:"\u8BC4\u6D4B\u96BE\u5EA6"},{default:()=>[createVNode(RadioGroup,{iconSize:20,class:styles$7.radioGroup,modelValue:state$4.eva.difficulty,"onUpdate:modelValue":B=>state$4.eva.difficulty=B},{default:()=>[createVNode(Radio,{name:"BEGINNER"},{default:()=>[createTextVNode("\u5165\u95E8")]}),createVNode(Radio,{name:"ADVANCED"},{default:()=>[createTextVNode("\u8FDB\u9636")]}),createVNode(Radio,{name:"PERFORMER"},{default:()=>[createTextVNode("\u5927\u5E08")]})]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6821\u97F3\u63D0\u9192"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.tuning,"onUpdate:modelValue":B=>state$4.sett.tuning=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6444\u50CF\u5934"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.sett.camera,"onUpdate:modelValue":B=>state$4.sett.camera=B},switchProps),{default:()=>[createTextVNode("off")]})]}),state$4.sett.camera&&createVNode(Fragment,null,[createVNode(Divider,null,null),createVNode("div",{class:styles$7.sliderWrap},[createVNode("div",{class:"cell__title"},[createTextVNode("\u900F\u660E\u5EA6")]),createVNode(Slider,{min:0,max:100,modelValue:state$4.sett.opacity,"onUpdate:modelValue":B=>state$4.sett.opacity=B},{button:()=>createVNode("div",{class:styles$7.slider},[state$4.sett.opacity])})])]),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u4FDD\u5B58\u5230\u76F8\u518C"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.eva.save,"onUpdate:modelValue":B=>state$4.eva.save=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u8BC4\u6D4B\u4F34\u594F"},{default:()=>[createVNode(Switch,mergeProps({modelValue:state$4.eva.mute,"onUpdate:modelValue":B=>state$4.eva.mute=B},switchProps),{default:()=>[createTextVNode("off")]})]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u6807\u51C6\u97F3\u9AD8"},{default:()=>[createVNode("div",{style:{display:"flex"}},[createVNode(RadioGroup,{iconSize:20,class:styles$7.radioGroup,modelValue:state$4.sett.hertz,"onUpdate:modelValue":B=>state$4.sett.hertz=B},{default:()=>[createVNode(Radio,{name:440},{default:()=>[createTextVNode("440")]}),createVNode(Radio,{name:442},{default:()=>[createTextVNode("442")]})]})])]}),createVNode(Divider,null,null),createVNode(Cell,{center:!0,border:!1,title:"\u53CD\u5E94\u65F6\u95F4(\u6BEB\u79D2)"},{default:()=>[createVNode(Field,{modelValue:state$4.eva.reactionTimeMs,"onUpdate:modelValue":B=>state$4.eva.reactionTimeMs=B,inputAlign:"right",onBlur:()=>{state$4.eva.reactionTimeMs=Math.max(-300,Math.min(300,state$4.eva.reactionTimeMs))||0}},null)]})])])}}),Setting=defineComponent({name:"ColexiuSetting",props:{active:{type:String,default:"1"}},setup(B){return()=>createVNode("div",{class:styles$7.setting},[createVNode(Tabs,{active:B.active},{default:()=>[createVNode(Tab,{title:"\u5168\u5C40\u8BBE\u7F6E",name:"1"},{default:()=>[createVNode(Seet,null,null)]}),createVNode(Tab,{title:"\u7EC3\u4E60\u8BBE\u7F6E",name:"2"},{default:()=>[createVNode(Practise,null,null)]}),createVNode(Tab,{title:"\u8BC4\u6D4B\u8BBE\u7F6E",name:"3"},{default:()=>[createVNode(Evaluat,null,null)]})]})])}});const modelWraper="_modelWraper_iddf4_1",wrap="_wrap_iddf4_8";var styles$3={modelWraper,wrap},ModelWraper=defineComponent({name:"modelWraper",props:{show:{type:Boolean,default:!1},onChangeModelType:{type:Function,default:()=>{}}},setup(B,R){return()=>createVNode(Teleport,{to:"body"},{default:()=>[createVNode("div",{class:styles$3.modelWraper},[createVNode(Transition,{mode:"out-in","enter-active-class":"animate__animated animate__flipInX","leave-active-class":"animate__animated animate__fadeOut"},{default:()=>[B.show&&createVNode("div",{class:styles$3.wrap},[createVNode("img",{onClick:()=>B.onChangeModelType("practice"),src:model1},null),createVNode("img",{onClick:()=>B.onChangeModelType("follow"),src:model3},null),createVNode("img",{onClick:()=>B.onChangeModelType("evaluation"),src:model2},null)])]})])]})}});const follow="_follow_1izp1_4",title="_title_1izp1_12",endBtns="_endBtns_1izp1_16",button="_button_1izp1_21",hasText="_hasText_1izp1_29",bigIcon="_bigIcon_1izp1_52",start="_start_1izp1_59";var styles$2={follow,title,endBtns,button,hasText,bigIcon,start},iconFollwBtn="/orchestra-music-score/assets/icon-follwBtn.40b797fe.svg";const togglePlayer=(B=!1)=>{let R=document.querySelector("#globalPlayer");R&&(R.style.display=B?"":"none")},data=reactive({list:[],index:0,start:!1});useToggle(!0);const noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=(B=!0)=>{if(postMessage({api:"cloudToggleFollow",content:{state:B?"start":"end"}}),B)followTime.value=Date.now();else{const R=Date.now()-followTime.value;followTime.value!==0&&R>0&&(followTime.value=0,updatePlayTime$1(R/1e3))}},initBehaviorId$1=""+new Date().valueOf();async function updatePlayTime$1(B){const R=useOriginSearch(),F=sessionStorage.getItem("behaviorId")||R.behaviorId||initBehaviorId$1,D=getRequestHostname(),G=useOriginSearch().id,U=location.hash.split("?")[0].split("/").pop()||G||"";try{const W=await request.post("/musicPracticeRecord/save",{prefix:D,data:{musicSheetId:U,sysMusicScoreId:U,feature:"CLOUD_STUDY_TRAIN",playTime:B,deviceType:getPlatform(),behaviorId:F}})}catch{}}const onClear=()=>{state$2.times.forEach(B=>{const R=document.querySelector(`div[data-vf=vf${B.id}]`);R&&(R.classList.remove("follow-error"),R.classList.remove("follow-success"))})},handleStart=()=>{onClear(),data.start=!0,openToggleRecord(!0),data.index=0,data.list=[],state.osmd.cursor.reset(),getNoteIndex(),refreshView()},handleEnd=()=>{data.start=!1,openToggleRecord(!1),data.index=0,state.osmd.cursor.reset(),getNoteIndex()},next=()=>{state.osmd.product?state.osmd.cursor.setPosition(state$2.times[data.index].cursorBox):state.osmd.cursor.next(),refreshView()},getNoteIndex=()=>{const B=state$2.times[data.index];return B.frequency?(noteFrequency.value=B.frequency,state$2.fixedKey=B.realKey,{id:B.id,min:B.frequency-(B.frequency-B.noteElement.pitch.prevFrequency)*.1,max:B.frequency+(B.noteElement.pitch.nextFrequency-B.frequency)*.1}):(data.index=data.index+1,next(),getNoteIndex())};let checking=!1;const onFollowTime=B=>{var F;const R=(F=B==null?void 0:B.content)==null?void 0:F.frequency;audioFrequency.value=R,data.list.push(R),checked()},checked=()=>{if(checking)return;checking=!0;const B=getNoteIndex();for(let R=0;RB.min&&F{const F=document.querySelector(`div[data-vf=vf${B.id}]`);F&&(R?(F.classList.remove("follow-error"),F.classList.add("follow-success")):(F.classList.remove("follow-success"),F.classList.add("follow-error")))};var Follow=defineComponent({name:"follow",setup(B,{expose:R}){return onMounted(()=>{togglePlayer(),console.log("\u5F00\u59CB\u76D1\u542C"),listenerMessage("cloudFollowTime",onFollowTime)}),onUnmounted(()=>{removeListenerMessage("cloudFollowTime",onFollowTime),togglePlayer(!0),onClear()}),R({data,handleEnd}),()=>createVNode(Teleport,{to:"#colexiu-detail-music-sheet"},{default:()=>[createVNode("div",{class:styles$2.follow},[createVNode(Transition,{name:"start",duration:300},{default:()=>[!data.start&&createVNode(Button,{style:{backgroundImage:`url(${iconFollwBtn})`},class:[styles$2.button,styles$2.start,styles$2.followBtn],onClick:()=>handleStart()},{default:()=>[createTextVNode("\u5F00\u59CB")]})]}),createVNode("div",{class:styles$2.title},[createVNode("span",null,[createTextVNode("\u97F3\u7B26\u9891\u7387: "),noteFrequency.value.toFixed(2)]),createVNode("span",{style:{color:"red",marginLeft:"10px"}},[createTextVNode("\u62FE\u97F3\u9891\u7387: "),audioFrequency.value.toFixed(2)]),createVNode("span",{style:{marginLeft:"10px"}},[createTextVNode("\u62FE\u97F3\u957F\u5EA6: "),data.list.length])])])]})}}),iconFollowEndBtn="/orchestra-music-score/assets/icon-followEndBtn.7fe21406.svg";const confirmShow=ref(!1),search$3=useOriginSearch(),startButtonShow=ref(!0),evaluatingRef=ref({}),settingPopup=ref(null);ref(null);const followRef=ref(null),animate={mounted:B=>{B.addEventListener("click",R=>{R.target.classList.add("animate__animated","animate__tada")}),B.addEventListener("animationend",R=>{R.target.classList.remove("animate__animated","animate__tada")})}},beforeCheck=B=>{var W,q,Y,K;const R=search$3.setting||{},F=(W=state$2.activeDetail)==null?void 0:W.paymentType,D=(q=state$2.activeDetail)==null?void 0:q.orderStatus,G=(Y=state$2.activeDetail)==null?void 0:Y.play,U=((K=state$3.user)==null?void 0:K.membershipDays)||0;if(useClientType()==="web"||G||R.feeType==="FREE")return B(!0);if((F==null?void 0:F.includes("VIP"))&&(F==null?void 0:F.includes("CHARGE"))&&!(U>0)&&D!=="PAID")return permissionPopup.active="memberAndDemand",permissionPopup.show=!0,B(!1);if(F==="VIP"&&!(U>0))return permissionPopup.active="member",permissionPopup.show=!0,B(!1);if(F==="CHARGE"&&D!=="PAID")return permissionPopup.active="demand",permissionPopup.show=!0,B(!1);B(!0)},back=()=>{postMessage({api:"back"})},startEvaluat=()=>{console.log("\u5F00\u59CB\u8BC4\u6D4B"),beforeCheck(B=>{B&&(setCurrentTime(0),state.evaluatingStatus=!0)})},modelType=ref("init"),modelWraperShow=ref(!0),onChangeModelType=B=>{var R;if(modelWraperShow.value=!1,B!==modelType.value){if(B==="evaluation")changeSpeed((R=state$2.activeDetail)==null?void 0:R.originalSpeed,!1),startEvaluat();else{const F=store_legacy.get("speeds")||{},D=useOriginSearch();F[D.id]&&changeSpeed(F[D.id])}nextTick(()=>{modelType.value=B})}};var Buttons=defineComponent({name:"Colexiu-Buttons",directives:{animate},props:{onSetMusicScoreType:{type:Function,default:B=>{}}},emits:["setMusicScoreType"],setup(B,{emit:R}){const F=useOriginSearch(),D={query:F},[G]=useWiredHeadsetCheck(),U=ref(),[W]=useMenu(),q=ref(!1),Y=()=>{D.query.modelType&&onChangeModelType(D.query.modelType)};onMounted(()=>{Y()});const K=ref(!1),Z=ref(""),j=te=>{Z.value=te.text,confirmShow.value=!0},Q=()=>{Z.value==="\u4E94\u7EBF\u8C31"?state$4.sett.type="staff":Z.value==="\u7B80\u8C31"?(state$4.sett.type="jianpu",state$4.sett.keySignature=!1):Z.value==="\u56FA\u5B9A\u8C03"&&(state$4.sett.type="jianpu",state$4.sett.keySignature=!0)},J=te=>{if(te==="staff")return state$4.sett.type===te;if(te==="shoudiao")return state$4.sett.type==="jianpu"&&!state$4.sett.keySignature;if(te==="guding")return state$4.sett.type==="jianpu"&&state$4.sett.keySignature};return()=>{var ne,ie,re,oe,le,fe,he,ge,ce;const te=((ne=state$2.activeDetail)!=null&&ne.isAppPlay?((ie=state$2.activeDetail)==null?void 0:ie.midiUrl)==="":state.isFirstPlay||((re=state.audiosInstance)==null?void 0:re.length)==1)||state.evaluatingStatus||((oe=state$2.activeDetail)==null?void 0:oe.isAppPlay)&&state$2.midiPlayIniting;return createVNode("div",{class:[styles$8.container,W.value?"animate__animated animate__fadeInDown":"animate__animated animate__fadeOutUp"]},[createVNode("div",{class:styles$8.leftButton},[!((le=D.query)!=null&&le.modelType)&&createVNode(Button,{class:[styles$8.button,styles$8.backbtn],onClick:back},{default:()=>[createVNode(ButtonIcon,{name:"icon-back"},null)]}),createVNode("div",{class:styles$8.titleWrap},[createVNode("div",{class:styles$8.title},[(fe=state$2.activeDetail)==null?void 0:fe.musicSheetName]),F.albumName&&createVNode("div",{class:styles$8.album},[F.albumName])])]),createVNode("div",{class:styles$8.centerButton},[createVNode(Transition,{name:"finish"},{default:()=>{var me,ye;return[G.value&&!((me=evaluatingRef.value)!=null&&me.connentLoading)&&!startButtonShow.value&&createVNode(Button,{style:{backgroundImage:`url(${iconEvaluatingEnd})`},class:[styles$8.button,styles$8.finish],onClick:()=>{var ve,pe;(pe=(ve=evaluatingRef.value)==null?void 0:ve.playerStop)==null||pe.call(ve)}},{default:()=>[createTextVNode("\u7ED3\u675F\u8BC4\u6D4B")]}),((ye=followRef==null?void 0:followRef.value)==null?void 0:ye.data.start)&&createVNode(Button,{style:{backgroundImage:`url(${iconFollowEndBtn})`},class:[styles$8.button,styles$8.finish,styles$8.followEndBtn],onClick:()=>{var ve,pe;(pe=(ve=followRef.value)==null?void 0:ve.handleEnd)==null||pe.call(ve)}},{default:()=>[createTextVNode("\u7ED3\u675F\u6F14\u594F")]})]}})]),createVNode("div",{class:[styles$8.moreButton],style:{opacity:state$2.initRendered?1:0}},[!((he=D.query)!=null&&he.modelType)&&modelType.value!=="init"&&!state$2.frozenMode&&createVNode(Button,{class:[styles$8.button,styles$8.hasText],disabled:state.evaluatingStatus&&!startButtonShow.value||((ge=followRef.value)==null?void 0:ge.data.start),onClick:()=>{var me,ye,ve;modelType.value==="practice"&&(resetPlayStatus(),setCurrentTime(0)),modelType.value==="evaluation"&&(state.evaluatingStatus=!1,(((me=evaluatingRef.value)==null?void 0:me.playStatus.value)==="play"||((ye=evaluatingRef.value)==null?void 0:ye.playStatus.value)==="connecting")&&((ve=evaluatingRef.value)==null||ve.cancelTheEvaluation())),modelType.value="init",modelWraperShow.value=!0}},{default:()=>[createVNode(ButtonIcon,{key:"modelType",name:"modelType"},null),createVNode("span",null,[createTextVNode("\u6A21\u5F0F")])]}),modelType.value==="evaluation"&&createVNode(Fragment,null,[createVNode(Popover,{show:q.value,"onUpdate:show":me=>q.value=me,overlay:!1,placement:"bottom-end",class:"cameraPopover","show-arrow":!1},{default:()=>[createVNode(CellGroup,{border:!1},{default:()=>[createVNode(Cell,{center:!0,title:"\u6444\u50CF\u5934"},{default:()=>[createVNode("div",{style:"display:flex;justify-content: flex-end;"},[createVNode(Switch,mergeProps({disabled:!startButtonShow.value,modelValue:state$4.sett.camera,"onUpdate:modelValue":me=>state$4.sett.camera=me},switchProps),{default:()=>[createTextVNode("off")]})])]}),state$4.sett.camera&&createVNode(Cell,{class:"cameraOpacity",center:!0,title:"\u900F\u660E\u5EA6"},{default:()=>[createVNode(Slider,{min:0,max:100,modelValue:state$4.sett.opacity,"onUpdate:modelValue":me=>state$4.sett.opacity=me},{button:()=>createVNode("div",{class:styles$8.slider},[state$4.sett.opacity])})]})]})],reference:()=>createVNode("div",null,[createVNode(Button,{class:[styles$8.button,styles$8.hasText]},{default:()=>[createVNode(ButtonIcon,{key:"camera",name:"camera"},null),createVNode("span",null,[createTextVNode("\u6444\u50CF\u5934")])]})])}),createVNode("div",{style:{display:"none"}},[state.evaluatingStatus?createVNode(Evaluating$1,{ref:evaluatingRef,key:"lianxi"},null):createVNode(Button,{class:[styles$8.button,styles$8.hasText],onClick:startEvaluat},{default:()=>[createVNode(ButtonIcon,{key:"evaluating",name:"evaluating"},null),createVNode("span",null,[createTextVNode("\u8BC4\u6D4B")])]})])]),modelType.value==="practice"&&createVNode(Fragment,null,[createVNode(Button,{class:[styles$8.button,styles$8.hasText],onClick:()=>changeMode(state.mode==="background"?"music":"background"),disabled:te},{default:()=>[createVNode(ButtonIcon,{key:"music",name:state.mode==="music"?"music":"accompaniment"},null),createVNode("span",null,[state.mode==="background"?"\u4F34\u594F":"\u539F\u58F0"])]}),createVNode(Button,{class:[styles$8.button,styles$8.hasText],onClick:sectionChange,disabled:state.evaluatingStatus},{default:()=>[createVNode(ButtonIcon,{key:"section",name:"section"+(state$2.section.length&&state$2.section.length<=2?state$2.section.length:"")},null),createVNode("span",null,[createTextVNode("\u9009\u6BB5")])]}),createVNode(Button,{class:[styles$8.button,styles$8.hasText],onClick:()=>{state$4.sett.fingering=!state$4.sett.fingering,event.emit("settingFingeringChange")}},{default:()=>[createVNode(ButtonIcon,{key:"music",name:state$4.sett.fingering?"fingeringOn":"fingeringOff"},null),createVNode("span",null,[createTextVNode("\u6307\u6CD5")])]})]),["practice","evaluation"].includes(modelType.value)&&createVNode(Popover,{trigger:"manual",overlay:!1,placement:"bottom",class:styles$8.popover,show:W.value&&state.speedShow&&!(state.evaluatingStatus||state.playState==="play"),"onUpdate:show":me=>state.speedShow=me},{default:()=>[createVNode(Speed,{ref:U,updateSpeed:me=>state.speed=me,changed:changeSpeed,mode:state.mode,changeMode,lib:{speed:state.speed},class:styles$8.speed},null)],reference:()=>createVNode(Button,{class:[styles$8.button,styles$8.hasText,styles$8.speedButton],disabled:state.evaluatingStatus||state.playState==="play",onClick:()=>{var me;(me=U.value)==null||me.refUpdateSpeed(state.speed),state.speedShow=!state.speedShow}},{default:()=>[createVNode(ButtonIcon,{name:"speed"},null),createVNode("span",null,[createTextVNode("\u901F\u5EA6")]),createVNode("span",{class:styles$8.label},[state.speed])]})}),(ce=state$2.activeDetail)!=null&&ce.notation?createVNode(Popover,{class:styles$8.toggleMusicType,placement:"bottom-end",show:K.value,"onUpdate:show":me=>{var ye;state.playState==="play"||state.evaluatingStatus&&!startButtonShow.value||((ye=followRef.value)==null?void 0:ye.data.start)||(K.value=me)}},{reference:()=>{var me;return createVNode(Button,{disabled:state.playState==="play"||state.evaluatingStatus&&!startButtonShow.value||((me=followRef.value)==null?void 0:me.data.start),class:[styles$8.button,styles$8.hasText,styles$8.speedButton]},{default:()=>[createVNode(ButtonIcon,{name:"icon-zhuanpu"},null),createVNode("span",null,[J("staff")?"\u8F6C\u7B80\u8C31":"\u8F6C\u4E94\u7EBF\u8C31"])]})},default:()=>createVNode(Fragment,null,[createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>j({text:"\u4E94\u7EBF\u8C31"})},[createVNode(ButtonIcon,{key:"type",name:J("staff")?"icon-staff-active":"icon-staff"},null),createVNode("div",{class:["action-text",J("staff")&&"action-active"]},[createTextVNode("\u4E94\u7EBF\u8C31")])]),createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>j({text:"\u7B80\u8C31"})},[createVNode(ButtonIcon,{key:"type",name:J("shoudiao")?"shuodiao-active":"shuodiao"},null),createVNode("div",{class:["action-text",J("shoudiao")&&"action-active"]},[createTextVNode("\u9996\u8C03")])]),createVNode("div",{role:"menuitem",class:"van-popover__action",onClick:()=>j({text:"\u56FA\u5B9A\u8C03"})},[createVNode(ButtonIcon,{key:"type",name:J("guding")?"guding-active":"guding"},null),createVNode("div",{class:["action-text",J("guding")&&"action-active"]},[createTextVNode("\u56FA\u5B9A\u8C03")])])])}):null,state$2.initRendered&&createVNode(Fragment,null,[createVNode(Button,{class:[styles$8.button,styles$8.hasText],onClick:()=>{var me;(me=settingPopup.value)==null||me.onShow()},disabled:state.evaluatingStatus&&!startButtonShow.value},{default:()=>[createVNode(ButtonIcon,{name:"setting"},null),createVNode("span",null,[createTextVNode("\u8BBE\u7F6E")])]}),createVNode(Popups,{ref:settingPopup,style:{borderRadius:"8px"}},{default:()=>[createVNode(Setting,{active:modelType.value=="practice"?"2":modelType.value=="evaluation"?"3":"1"},null)]})]),modelType.value==="follow"&&createVNode(Fragment,null,[createVNode(Follow,{ref:followRef},null)])]),state$2.initRendered&&!state$2.frozenMode&&createVNode(ModelWraper,{show:modelWraperShow.value,onChangeModelType},null),createVNode(FloatWraper,null,null),createVNode(Dialog.Component,{teleport:"body",class:styles$e.confirm,style:{overflow:"initial"},show:confirmShow.value,"onUpdate:show":me=>confirmShow.value=me,message:"\u8BBE\u7F6E\u6210\u529F\uFF0C\u662F\u5426\u7ACB\u5373\u91CD\u65B0\u52A0\u8F7D\uFF1F"},{title:()=>createVNode("img",{class:styles$e.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$e.footer},[createVNode("img",{src:iconCancel,onClick:()=>confirmShow.value=!1},null),createVNode("img",{src:iconConfirm,onClick:()=>{Q(),useReload()}},null)])})])}}});const scoreInfos={1:{img:Image1,tips:"\u4F60\u7684\u6F14\u594F\u4E0D\u592A\u597D\uFF0C\u97F3\u51C6\u548C\u5B8C\u6574\u6027\u8FD8\u9700\u52A0\u5F3A\uFF0C\u518D\u7EC3\u4E00\u7EC3\u5427\uFF5E",mome:"\u6562\u4E8E\u5C1D\u8BD5"},2:{img:Image2,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u719F\u7EC3\uFF0C\u97F3\u51C6\u548C\u5B8C\u6574\u6027\u8FD8\u9700\u52A0\u5F3A\uFF0C\u52A0\u7D27\u8BAD\u7EC3\u624D\u80FD\u6709\u597D\u6210\u7EE9\u54E6\uFF5E",mome:"\u8FD8\u8981\u52A0\u6CB9\u54E6"},3:{img:Image3,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u6D41\u7545\uFF0C\u97F3\u51C6\u548C\u8282\u594F\u8FD8\u9700\u52A0\u5F3A\uFF0C\u79D1\u5B66\u7684\u7EC3\u4E60\u624D\u80FD\u66F4\u5B8C\u7F8E\u54E6\uFF5E",mome:"\u7A81\u7834\u81EA\u6211"},4:{img:Image4,tips:"\u4F60\u7684\u6F14\u594F\u8FD8\u4E0D\u9519\uFF0C\u7EE7\u7EED\u52A0\u6CB9\u5427\uFF0C\u52A0\u5F3A\u97F3\u51C6\uFF0C\u79BB\u5B8C\u7F8E\u5C31\u5DEE\u4E00\u6B65\u5566\uFF5E",mome:"\u5D2D\u9732\u5934\u89D2"},5:{img:Image5,tips:"\u4F60\u7684\u6F14\u594F\u975E\u5E38\u4E0D\u9519\uFF0C\u97F3\u51C6\u7684\u628A\u63E1\u548C\u8282\u594F\u7A0D\u6709\u7455\u75B5\uFF0C\u5B8C\u6574\u6027\u628A\u63E1\u7684\u5F88\u597D~",mome:"\u4F60\u5F88\u68D2"}};ref(!1);const search$2=useOriginSearch();var Content=defineComponent({name:"ColexiuEvaluating",props:{data:{type:Object,default:()=>null}},emits:["restart","upload"],setup(B,{emit:R}){const F=ref(!1),D=ref(""),{data:G}=toRefs(B),U=location.origin.indexOf("localhost")>-1||location.origin.indexOf("192.168")>-1?"":"/orchestra-music-score",W=()=>{var j,Q,J,te,ne,ie,re,oe,le;const Z={id:(j=G.value)==null?void 0:j.recordId,musicId:search$2.id,name:((Q=state$3.user)==null?void 0:Q.username)||"",subjectName:(((J=state$3.user)==null?void 0:J.subjectName)||"").split(",")[0]||"",avatar:encodeURIComponent(((te=state$3.user)==null?void 0:te.avatar)||""),score:((ne=G.value)==null?void 0:ne.score)||0,examSongName:((ie=state$2.activeDetail)==null?void 0:ie.examSongName)||""};return state$2.isPercussion||(Z.intonation=(re=G.value)==null?void 0:re.intonation,Z.cadence=(oe=G.value)==null?void 0:oe.cadence,Z.integrity=(le=G.value)==null?void 0:le.integrity),`${location.origin}${U}/share-colexiu-evaluating/index.html?${queryString.stringify(Z)}`},q=Z=>{const j=Z.target;j&&(j.contentWindow.setPng=Q=>{D.value=Q})},Y=()=>{!D.value||postMessage({api:"shareAchievements",content:{title:"\u5206\u4EAB\u6211\u7684\u4E50\u5668\u7EC3\u4E60\u8FDB\u5EA6\uFF0C\u4E00\u8D77\u89C1\u8BC1\u6211\u7684\u6210\u957F\uFF01",desc:"\u6652\u4E00\u4E0B\u6211\u7684\u8BC4\u6D4B\u5206\u6570\uFF0C\u5FEB\u6765\u201C\u5C0F\u9177AI\u201D\u4E0A\u548C\u6211PK\u4E00\u4E0B\u5427\uFF01",image:D.value,video:"",type:"image",button:["copy"],url:W()}},Z=>{var j,Q,J;(j=Z==null?void 0:Z.content)!=null&&j.status&&(F.value=!1),(Q=Z==null?void 0:Z.content)!=null&&Q.message&&Toast((J=Z==null?void 0:Z.content)==null?void 0:J.message)})},K=()=>{var Z;postMessage({api:"openWebView",content:{url:location.origin+U+"/colexiu-report.html?source=evaluation&musicId="+search$2.id+"&id="+((Z=G.value)==null?void 0:Z.recordId)||"",orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})};return()=>{var j,Q;const Z=getLeveByScoreId((j=G.value)==null?void 0:j.score);return createVNode("div",null,[createVNode("div",{class:styles$e.box},[createVNode("div",{class:styles$e.wrap},[createVNode("div",{class:styles$e.wrapContainer},[createVNode("div",{class:styles$e.top},[createVNode("div",{class:styles$e.title},[createVNode("div",{style:{position:"relative",zIndex:1,"white-space":"nowrap"}},[createVNode("span",{class:styles$e.num},[(Q=G.value)==null?void 0:Q.score]),createVNode("span",{class:styles$e.txt},[createTextVNode("\u5206 "),scoreInfos[Z].mome])]),createVNode("div",{class:styles$e.line},null)]),createVNode("img",{class:styles$e.iconTop,src:scoreInfos[Z].img},null)]),createVNode("div",{class:styles$e.evaluatWrap},[createVNode(Grid,null,{default:()=>[createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$e.evaluatIcon,src:IntonationIcon},null),createVNode("span",{class:styles$e.evaluatTitle},[createTextVNode("\u97F3\u51C6")])]),text:()=>{var J;return createVNode("span",{class:styles$e.fraction},[(J=G.value)==null?void 0:J.intonation,createVNode("span",null,[createTextVNode("\u5206")])])}}),createVNode("div",{class:styles$e.line},null),createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$e.evaluatIcon,src:CadenceIcon},null),createVNode("span",{class:styles$e.evaluatTitle},[createTextVNode("\u8282\u594F")])]),text:()=>{var J;return createVNode("span",{class:styles$e.fraction},[(J=G.value)==null?void 0:J.cadence,createVNode("span",null,[createTextVNode("\u5206")])])}}),createVNode("div",{class:styles$e.line},null),createVNode(GridItem,null,{icon:()=>createVNode("div",null,[createVNode("img",{class:styles$e.evaluatIcon,src:IntegrityIcon},null),createVNode("span",{class:styles$e.evaluatTitle},[createTextVNode("\u5B8C\u6574\u6027")])]),text:()=>{var J;return createVNode("span",{class:styles$e.fraction},[(J=G.value)==null?void 0:J.integrity,createVNode("span",null,[createTextVNode("\u5206")])])}})]})]),createVNode("div",{class:styles$e.tips},[scoreInfos[Z].tips])]),createVNode("div",{class:styles$e.btns},[state$2.frozenMode?null:createVNode(Button,{onClick:()=>{state.evaluatingStatus=!1,onChangeModelType("practice")}},{default:()=>[createVNode("img",{class:styles$e.btnIcon,src:iconLianxi},null)]}),createVNode(Button,{style:{margin:"0 4px"},onClick:()=>R("restart")},{default:()=>[createVNode("img",{class:styles$e.btnIcon,src:TryIcon},null)]}),createVNode(Button,{onClick:K},{default:()=>[createVNode("img",{class:styles$e.btnIcon,src:iconReport,alt:"\u67E5\u770B\u62A5\u544A"},null)]})]),createVNode("div",{class:styles$e.rigthBtns},[createVNode("div",{class:styles$e.skepBtn,onClick:()=>R("upload")},[createVNode("img",{src:iconUpload},null),createTextVNode("\u4E0A\u4F20")]),createVNode("div",{class:styles$e.skepBtn,onClick:()=>F.value=!0},[createVNode("img",{src:iconShare},null),createTextVNode("\u5206\u4EAB")])])]),createVNode(Popup,{teleport:"body",show:F.value,style:{background:"transparent"}},{default:()=>[createVNode("div",{style:{textAlign:"right"}},[createVNode(Button,{class:styles$e.sbtn,onClick:Y,round:!0,type:"primary",color:"#2DC7AA"},{default:()=>[createTextVNode("\u5206\u4EAB")]}),createVNode(Button,{class:styles$e.sbtn,onClick:()=>F.value=!1,round:!0},{default:()=>[createTextVNode("\u5173\u95ED")]})]),createVNode("iframe",{style:{width:"50vw",border:"none",height:"70vh",marginTop:"1vh"},src:W(),onLoad:q},null)]}),createVNode(Button,{class:styles$e.button,icon:backIcon,onClick:()=>R("restart")},null)])])}}});const evaluatingShow=ref(!1),open=ref(!1);var Evaluating=defineComponent({name:"ColexiuEvaluating",props:{data:{type:Object,default:()=>null}},emits:["restart"],setup(B){const R=ref(!1),F=state$4.sett.camera&&state$4.eva.save;console.log(state$4.sett.camera,state$4.eva.save);const D=U=>{var W,q;postMessage({api:"proxyServiceMessage",content:{header:{commond:"videoUpload",status:200,type:"SOUND_COMPARE"},body:{filePath:(W=U==null?void 0:U.content)==null?void 0:W.filePath,recordId:(q=B.data)==null?void 0:q.recordId}}})},G=()=>{F?postMessage({api:"videoUpdate"},U=>{if(R.value=!1,U!=null&&U.content){if(U.content.type==="error"){Toast(U.content.message);return}D(U)}}):(R.value=!1,D(),Toast.success("\u4E0A\u4F20\u6210\u529F"))};return()=>createVNode("div",null,[createVNode(Popup,{position:"bottom",show:evaluatingShow.value,"onUpdate:show":U=>evaluatingShow.value=U,onOpen:()=>open.value=!0,onClosed:()=>open.value=!1,teleport:"body",style:{backgroundColor:"transparent"}},{default:()=>[open&&createVNode(Content,{data:B.data,onUpload:()=>R.value=!0,onRestart:()=>evaluatingShow.value=!1},null)]}),createVNode(Dialog.Component,{teleport:"body",class:styles$e.confirm,style:{overflow:"initial"},show:R.value,"onUpdate:show":U=>R.value=U,message:`\u8BC4\u6D4B${F?"\u97F3\u89C6\u9891":"\u97F3\u9891"}\u662F\u5426\u4FDD\u5B58\u6F14\u594F\uFF1F`},{title:()=>createVNode("img",{class:styles$e.iconTitle,src:iconTitle},null),footer:()=>createVNode("div",{class:styles$e.footer},[createVNode("img",{src:iconCancel,onClick:()=>R.value=!1},null),createVNode("img",{src:iconConfirm,onClick:G},null)])})])}});const soundNeedShow=()=>{if(state.evaluatingStatus&&!permissionPopup.show){let B=-1;const R=localStorage.getItem(storeKeys.lastCheckTime);try{const F=dayjs(parseFloat(R||"0"));F.isValid()&&(B=Math.abs(F.diff(dayjs(new Date().valueOf()),"day")))}catch{}(state$4.sett.tuning||B>0||!R)&&(soundEffectShow.value=!0)}},setWiredStatus=B=>{state.evaluatingStatus?(permissionPopup.active="earphone",permissionPopup.show=!(B!=null&&B.content.checkIsWired),soundNeedShow()):permissionPopup.show=!1},useWiredHeadsetCheck=()=>{const B=ref(!1);return watch(()=>state.evaluatingStatus,()=>{postMessage({api:"isWiredHeadsetOn"},setWiredStatus)}),watch(()=>permissionPopup.show,()=>{soundNeedShow()}),watch([()=>state.evaluatingStatus],()=>{Toast.clear(),state.evaluatingStatus||(state.evaluatingTips=!1,pause(),setCurrentTime(0)),state$4.sett.fingering&&event.emit("settingFingeringChange")}),watch([()=>state.evaluatingStatus,()=>permissionPopup.show,()=>soundEffectShow.value],([R,F,D])=>{B.value=R&&!F&&!D,state.evaluatingStatus||(state$2.evaluatings={},evaluatingShow.value=!1)}),onMounted(()=>{listenerMessage("listenerWiredStatus",setWiredStatus)}),onBeforeUnmount(()=>{removeListenerMessage("listenerWiredStatus",setWiredStatus)}),[B]},browserInfo$2=browser(),useFee=(B,R)=>{var K,Z,j;console.log("maxtime",B,R);const F=((K=state$2.activeDetail)==null?void 0:K.orderStatus)||R,G=useOriginSearch().setting||{};if(((Z=state$2.activeDetail)==null?void 0:Z.play)||G.feeType==="FREE")return;const U=useClientType();if(!browserInfo$2.isApp&&U==="web"||(B==null?void 0:B.includes("VIP"))&&((j=state$3.user)==null?void 0:j.membershipDays)>0||(B==null?void 0:B.includes("CHARGE"))&&F==="PAID")return;const W=ref(-1),q=state$2.times[state$2.times.length-1];q&&(W.value=Math.max(10,q.time*state$2.freeRate));const Y=Q=>{var te,ne,ie;const J=((te=state$2.activeDetail)==null?void 0:te.orderStatus)||R;U!="web"&&W.value>=0&&state.currentTimeNum>=W.value&&((B==null?void 0:B.includes("CHARGE"))&&B.includes("VIP")?J!=="PAID"&&!(((ne=state$3.user)==null?void 0:ne.membershipDays)>0)&&(permissionPopup.active="memberAndDemand",permissionPopup.show=!0,pause()):B==="CHARGE"?J!=="PAID"&&(permissionPopup.active="demand",permissionPopup.show=!0,pause()):B==="VIP"&&(((ie=state$3.user)==null?void 0:ie.membershipDays)>0||(permissionPopup.active="member",permissionPopup.show=!0,pause())))};state.audiosInstance.event.on("timeupdate",Y),listenerMessage("cloudTimeUpdae",Y),onBeforeUnmount(()=>{state.audiosInstance.event.off("timeupdate",Y),removeListenerMessage("cloudTimeUpdae",Y)})},search$1=useOriginSearch(),browserInfo$1=browser(),useClientType=()=>{const B=useOriginSearch();if(B.client)return B.client;let R=location.pathname.indexOf("/orchestra-student/")===0||browserInfo$1.isStudent,F=location.pathname.indexOf("/orchestra-teacher/")===0||browserInfo$1.isTeacher;return R?"student":F?"teacher":"web"},MemberDefaultData={membershipDays:1},useUpdateMember=()=>{const B=getRequestHostname();request.get(`/musicSheet/detail/${search$1.id}`,{prefix:B}).then(R=>{state$2.activeDetail&&(state$2.activeDetail.orderStatus=R.data.orderStatus,state$2.activeDetail.play=R.data.play)})},useUser=()=>{const B=usePageVisibility(),R=async()=>{try{const F=useClientType();if(F==="student"){const{data:D}=await request.get("/appLoginUser/getUserInfo");state$3.user=D}if(F==="teacher"){const{data:D}=await request.get("/appLoginUser/getUserInfo",{prefix:"/api-teacher"});state$3.user={...MemberDefaultData,...D}}F==="web"&&(state$3.user={...MemberDefaultData})}catch{}};R(),watch(B,async F=>{var D,G;permissionPopup.show=!1,F==="visible"&&((D=state$3.user)==null?void 0:D.membershipDays)===0&&R(),F==="visible"&&((G=state$2.activeDetail)==null?void 0:G.orderStatus)!=="PAID"&&useUpdateMember()})},typeById={2:{name:"flute",direction:"transverse"},4:{name:"clarinet",direction:"vertical",width:"1rem",paddingLeft:"0rem"},5:{name:"saxophone",direction:"vertical",width:"2rem"},6:{name:"saxophone",direction:"vertical",width:"2rem"},12:{name:"trumpet",direction:"transverse",height:"80px"},13:{name:"horn",direction:"vertical",width:"3.5rem"},14:{name:"trombone",direction:"transverse",height:"80px"},15:{name:"up-bass-horn",direction:"vertical",width:"3rem"},17:{name:"tuba",direction:"vertical",width:"3rem"},120:{name:"piccolo",direction:"vertical",width:"1rem"},136:{name:"hulusi-flute",direction:"vertical",width:"1.2rem"},135:{name:"pan-flute",direction:"vertical",width:"2.5rem"},134:{name:"ocarina",direction:"vertical",width:"2rem"},137:{name:"melodica",direction:"transverse"},130:{name:"ukulele",direction:"vertical",width:"2rem"},140:{name:"mouthorgan",direction:"transverse",height:"80px"},150:{name:"piano",direction:"transverse",height:"80px"}},relationships={flute17:{59:[27,26,25,15,24,22,17,20],60:[1,2,3,5,7,9,11,12,13,15],1060:[1,2,3,5,7,9,1011,12,13,15],61:[1,2,3,5,7,9,13,15],1061:[1,2,3,5,7,9,1013,15],62:[1,2,3,5,7,9,15],1062:[1,2,3,5,7,9,1010,15],63:[1,2,3,5,7,9,10,15],1063:[1,2,3,5,7,1009,10,15],64:[1,2,3,5,7,10,15],1064:[1,2,3,5,1007,10,15],65:[1,2,3,5,10,15],1065:[1,2,3,1005,9,10,15],66:[1,2,3,9,10,15],1066:[1,2,3,1009,10,15],67:[1,2,3,10,15],1067:[1,2,3,1004,10,15],68:[1,2,3,4,10,15],1068:[[1,2,1003,4,10,15],[1,2,1003,1004,10,15]],69:[1,2,10,15],1069:[1,1002,10,14],70:[[1,5,10,15],[1,10,14]],1070:[1,1005,10,15],71:[1,10,15],1071:[1,10,1015],72:[1,10],1072:[1001,10],73:[13],1073:[1006,13],74:[2,3,5,7,9,15],1074:[2,3,5,7,9,1013,15],75:[2,3,5,7,9,10,15],1075:[2,3,5,7,9,10,15],76:[1,2,3,5,7,10,15],1076:[1,2,3,5,1007,10,15],77:[1,2,3,5,10,15],1077:[1,2,3,1005,9,10,15],78:[1,2,3,9,10,15],1078:[1,2,3,1009,10,15],79:[1,2,3,10,15],1079:[1,2,3,4,10,15],80:[1,2,3,4,10,15],1080:[1,2,1003,4,10,15],81:[1,2,10,15],1081:[1,1002,10,15],82:[[1,5,10],[1,10,14]],1082:[1,1005,10,15],83:[1,10,15],1083:[1,10,1015],84:[1,10],1084:[1001,10],85:[10],1085:[1006,10],86:[2,3,10,15],1086:[2,3,1008,10,15],87:[1,2,3,4,5,7,8,10,15],1087:[1,2,1003,4,5,7,8,10,15],88:[1,2,5,7,10,15],1088:[1,1002,5,7,10,15],89:[1,3,5,10,15],1089:[1,3,1005,9,10,15],90:[1,3,9,10,15],1090:[1,3,9,10,1015],91:[1,2,3,10],1091:[1,2,3,1006,10],92:[2,3,4,10],1092:[2,3,4,1006,10],93:[2,5,10,15],1093:[1002,5,10,15],94:[5,6,15],1094:[1,3,1005,1006,8,15],95:[1,3,8,15],1095:[1,3,8,10,1015],96:[1,2,3,4,5,11],1096:[1001,2,3,4,5,11]},flute:{59:[27,26,25,15,24,22,17,20],60:[27,26,25,15,24,22,17,20],61:[27,26,25,15,24,22,17,21],62:[27,26,25,15,24,22,17],63:[27,26,25,15,24,22,17,19],64:[27,26,25,15,24,22,19],65:[27,26,25,15,24,19],66:[27,26,25,15,17,19],67:[27,26,25,15,19],68:[27,26,25,15,18,19],69:[27,26,15,19],70:[[27,14,19],[27,24,15,19]],71:[27,15,19],72:[27,19],73:[19],74:[26,25,24,22,17,15],75:[26,25,24,22,17,19,15],76:[27,26,25,15,24,22,19],77:[27,26,25,15,24,19],78:[27,26,25,15,17,19],79:[27,26,25,15,19],80:[27,26,25,15,18,19],81:[27,26,15,19],82:[[27,14,19],[27,24,15,19]],83:[27,15,19],84:[27,19],85:[19],86:[26,25,15,19],87:[27,26,25,15,24,22,17,18,19],88:[27,26,15,24,22,19],89:[27,25,24,15,19],90:[27,25,17,15,19],91:[27,26,25,19],92:[26,25,18,19],93:[26,24,15,19],94:[23,24,15,19],95:[27,25,15,16],96:[27,26,25,18,24,19]},clarinet:{52:[[3,4,6,8,9,11,14,18,20],[3,4,6,8,9,11,14,20]],53:[[3,4,6,8,9,11,12,20],[3,4,6,8,9,11,18,20]],54:[[3,4,6,8,9,11,13,18,20],[3,4,6,8,9,11,13,20],[3,4,6,8,9,11,15]],55:[3,4,6,8,9,11,20],56:[3,4,6,8,9,11,16,20],57:[3,4,6,8,9,20],58:[3,4,6,8,20],59:[[3,4,6,9,20],[3,4,6,8,10,20]],60:[3,4,6,20],61:[3,4,6,7,20],62:[3,4,20],63:[[3,4,20,24],[3,4,5,20],[3,8,20]],64:[3,20],65:[20],66:[[3],[20,23,24]],67:[],68:[2],69:[1],70:[1,19],71:[[3,4,6,8,9,11,14,18,19,20],[3,4,6,8,9,11,14,19,20]],72:[[3,4,6,8,9,11,12,19,20],[3,4,6,8,9,11,18,19,20]],73:[[3,4,6,8,9,11,13,19,20],[3,4,6,8,9,11,13,18,19,20],[3,4,6,8,9,11,15,19,20]],74:[3,4,6,8,9,11,19,20],75:[3,4,6,8,9,11,16,19,20],76:[3,4,6,8,9,19,20],77:[3,4,6,8,19,20],78:[[3,4,6,9,19,20],[3,4,6,8,10,19,20]],79:[3,4,6,19,20],80:[3,4,6,7,19,20],81:[3,4,19,20],82:[[3,4,19,20,24],[3,4,5,19,20],[3,4,8,19,20]],83:[3,19,20],84:[19,20],85:[4,6,8,9,19,20],86:[4,6,8,16,19,20],87:[[4,6,8,10,16,19,20],[4,6,9,16,19,20]],88:[4,6,16,19,20],89:[4,6,7,16,19,20]},trumpet:{0:[1,2,3],54:[4,5,6],55:[4,2,6],56:[1,5,6],57:[4,5,3],58:[4,2,3],59:[1,5,3],60:[1,2,3],61:[4,5,6],62:[4,2,6],63:[1,5,6],64:[4,5,3],65:[4,2,3],66:[1,5,3],67:[1,2,3],68:[1,5,6],69:[4,5,3],70:[4,2,3],71:[1,5,3],72:[1,2,3],73:[4,5,3],74:[4,2,3],75:[1,5,3],76:[1,2,3],77:[4,2,3],78:[1,4,3],79:[1,2,3],80:[1,5,6],81:[4,5,3],82:[4,2,3],83:[1,5,3],84:[1,2,3]},horn:{53:[1],54:[2],55:[],56:[2,3],57:[1,2],58:[1],59:[2],60:[],61:[1,2],62:[1],63:[2],64:[],65:[1],66:[2],67:[],68:[0,2,3],69:[0,1,2],70:[0,1],71:[0,2],72:[0],73:[0,2,3],74:[0,1,2],75:[0,1],76:[0,2],77:[0],78:[0,2],79:[0],80:[0,2,3],81:[0,1,2],82:[0,1],83:[0,2],84:[0]},upBassHorn:{0:[1,2,3],40:[4,5,6],41:[4,2,6],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,6],48:[4,2,6],49:[1,5,6],50:[4,5,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3],59:[4,5,3],60:[4,2,3],61:[1,5,3],62:[1,2,3],63:[4,2,3],64:[1,5,3],65:[1,2,3],66:[1,5,6],67:[4,5,3],68:[4,2,3],69:[1,5,3],70:[1,2,3]},trombone:{0:[1],40:[22],41:[11],42:[5],43:[4],44:[3],45:[2],46:[1],47:[22],48:[11],49:[5],50:[4],51:[3],52:[2],53:[1],54:[5],55:[4],56:[3],57:[2],58:[1],59:[4],60:[3],61:[2],62:[1],63:[3],64:[2],65:[1],66:[5],67:[4],68:[3],69:[2],70:[1]},saxophone:{58:[2,4,5,13,17,18,19,23],59:[2,4,5,11,17,18,19,23],60:[2,4,5,17,18,19,23],61:[2,4,5,12,17,18,19,23],62:[2,4,5,17,18,19],63:[2,4,5,17,18,19,22],64:[2,4,5,17,18],65:[2,4,5,17],66:[[2,4,5,18],[2,4,5,17,21]],67:[2,4,5],68:[2,4,5,10],69:[2,4],70:[[2,4,16],[2,17],[2,3]],71:[2],72:[[4],[2,15]],73:[],74:[2,4,5,6,17,18,19],75:[2,4,5,6,17,18,19,22],76:[2,4,5,6,17,18],77:[2,4,5,6,17],78:[[2,4,5,6,18],[2,4,5,6,17,21]],79:[2,4,5,6],80:[2,4,5,6,10],81:[2,4,6],82:[[2,4,6,16],[2,6,17],[2,3,6]],83:[2,6],84:[[4,6],[2,6,15]],85:[6],86:[6,9],87:[6,7,8],88:[6,8,9,14],89:[[6,7,8,9,14],[1,4,6]]},tuba:{0:[1,2,3],28:[4,5,6],29:[4,2,6],30:[1,5,6],31:[4,5,3],32:[4,2,3],33:[1,5,3],34:[1,2,3],35:[4,5,6],36:[4,2,6],37:[1,5,6],38:[4,5,3],39:[4,2,3],40:[1,5,3],41:[1,2,3],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,3],48:[4,2,3],49:[1,5,3],50:[1,2,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3]},piccolo:{72:[11,2,33,4,5,6,7,8],73:[11,2,33,4,5,6,7,88],74:[11,2,33,4,5,6,7],75:[11,2,33,4,5,6,77],76:[11,2,33,4,5,6],77:[11,2,33,4,5,7,8],78:[11,2,33,4,6,7],79:[11,2,33,4],80:[11,2,33,5,6,77],81:[11,2,33],82:[[11,2,4,5],[11,3,4,5]],83:[[11,2],[11,33,4]],84:[11,33],85:[[2,33],[11]],86:[33],87:[33,4,5,6,7],88:[1,2,33,4,5,6],89:[1,2,33,4,5,7],90:[1,2,33,4,6],91:[1,2,33,4],92:[1,2,33,5],93:[1,2,33],94:[1,2,33,5,6,7],95:[1,2,33,5,6],96:[1,2,5,6],97:[1,2,4,5,7,8],98:[1,2,4]},smallDrum:{0:["active","active-left","active-right"],64:["left","right"]},hulusi:{59:[7,6,5,4,3,2,1],60:[7,6,5,4,3,2],61:[7,6,5,4,3],62:[7,6,5,4],63:[7,6,5],64:[7,6],65:[[7,5,4,3,2,1],[7,5,4,3,2],[7,66]],66:[7]},pan:{54:[21],56:[20],58:[19],60:[18],62:[17],64:[16],66:[15],68:[14],70:[13],72:[12],74:[11],76:[10],78:[9],80:[8],82:[7],84:[6],86:[5],88:[4],90:[3],92:[2],94:[1]},ocarina:{57:[1,2,3,4,5,6,7,8,9,10,11,12],58:[1,2,3,4,5,6,8,9,10,11,12],59:[1,2,4,5,6,8,9,10,11,12],60:[1,2,4,5,6,11,12],61:[1,2,4,5,6,7,8,9,11,12],62:[1,2,4,5,6,8,9,11,12],63:[1,2,4,5,6,8,10,11,12],64:[1,2,4,5,6,8,11,12],65:[1,2,4,5,6,11,12],66:[1,2,4,6,9,11,12],67:[1,2,4,6,11,12],68:[1,2,6,9,11,12],69:[1,2,6,11,12],70:[1,2,6,9,11,12],71:[1,6,9,11,12],72:[6,11,12],73:[2,6,12],74:[6,12],75:[2,6],76:[6],77:[]},melodica:{56:[1],57:[2],58:[3],59:[4],60:[5],61:[6],62:[7],63:[8],64:[9],65:[10],66:[11],67:[12],68:[13],69:[14],70:[15],71:[16],72:[17],73:[18],74:[19],75:[20],76:[21],77:[22],78:[23],79:[24],80:[25],81:[26],82:[27],83:[28],84:[29],85:[30],86:[31],87:[32]},ukulele:{60:[3,300],61:[3,301],62:[3,302],63:[3,303],64:[2,200],65:[2,201],66:[2,202],67:[2,203],68:[2,204],69:[1,100],70:[1,101],71:[1,102],72:[1,103],73:[1,104],74:[1,105],75:[1,106],76:[1,107],77:[1,108],78:[1,109],79:[1,110],80:[1,111],81:[1,112],82:[1,113],83:[1,114],84:[1,115],85:[1,116],86:[1,117]},mouthorgan:{53:[101],54:[1],55:[102],56:[2],57:[103],58:[3],59:[104],60:[105],61:[4],62:[106],63:[5],64:[107],65:[108],66:[6],67:[109],68:[7],69:[110],70:[8],71:[111],72:[112],73:[9],74:[113],75:[10],76:[114],77:[115],78:[11],79:[116],80:[12],81:[117],82:[13],83:[118],84:[119],85:[14],86:[120],87:[15],88:[121],89:[122]},piano:{21:[101],22:[1],23:[102],24:[103],25:[2],26:[104],27:[3],28:[105],29:[106],30:[4],31:[107],32:[5],33:[108],34:[6],35:[109],36:[110],37:[7],38:[111],39:[8],40:[112],41:[113],42:[9],43:[114],44:[10],45:[115],46:[11],47:[116],48:[117],49:[12],50:[118],51:[13],52:[119],53:[120],54:[14],55:[121],56:[15],57:[122],58:[16],59:[123],60:[124],61:[17],62:[125],63:[18],64:[126],65:[127],66:[19],67:[128],68:[20],69:[129],70:[21],71:[130],72:[131],73:[22],74:[132],75:[23],76:[133],77:[134],78:[24],79:[135],80:[25],81:[136],82:[26],83:[137],84:[138],85:[27],86:[139],87:[28],88:[140],89:[141],90:[29],91:[142],92:[30],93:[143],94:[31],95:[144],96:[145],97:[32],98:[146],99:[33],100:[147],101:[148],102:[34],103:[149],104:[35],105:[150],106:[36],107:[151],108:[152]}};var getTypes=async B=>{switch(B){case"flute":return{json:(await __vitePreload(()=>import("./index.9827614a.js"),[])).default,relationship:relationships.flute,height:"60px",styles:{}};case"clarinet":return{json:(await __vitePreload(()=>import("./index.81bcab95.js"),[])).default,relationship:relationships.clarinet,styles:{marginLeft:".4rem",marginRight:".7rem"}};case"trumpet":return{json:(await __vitePreload(()=>import("./index.562e6907.js"),[])).default,relationship:relationships.trumpet};case"horn":return{json:(await __vitePreload(()=>import("./index.677031cc.js"),[])).default,relationship:relationships.horn,height:"212px",width:"252px"};case"tuba":return{json:(await __vitePreload(()=>import("./index.5c50a9f0.js"),[])).default,relationship:relationships.tuba};case"piccolo":return{json:(await __vitePreload(()=>import("./index.f292a388.js"),[])).default,relationship:relationships.piccolo};case"up-bass-horn":return{json:(await __vitePreload(()=>import("./index.50d887bb.js"),[])).default,relationship:relationships.upBassHorn};case"trombone":return{json:(await __vitePreload(()=>import("./index.65d4cb1f.js"),[])).default,relationship:relationships.trombone};case"saxophone":return{json:(await __vitePreload(()=>import("./index.66139d6f.js"),[])).default,relationship:relationships.saxophone,styles:{marginLeft:".2rem",marginRight:".3rem"}};case"small-drum":return{json:(await __vitePreload(()=>import("./index.c980c934.js"),[])).default,relationship:relationships.smallDrum,width:"180px"};case"hulusi-flute":return{json:(await __vitePreload(()=>import("./index.1c832d4b.js"),[])).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"pan-flute":return{json:(await __vitePreload(()=>import("./index.065f17dc.js"),[])).default,relationship:relationships.pan,width:"240px",styles:{marginTop:"auto",marginLeft:".6rem",marginRight:".7rem"}};case"ocarina":return{json:(await __vitePreload(()=>import("./index.b1ee2f73.js"),[])).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"melodica":return{json:(await __vitePreload(()=>import("./index.150cabd9.js"),[])).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"ukulele":return{json:(await __vitePreload(()=>import("./index.db14ec83.js"),[])).default,relationship:relationships.ukulele};case"mouthorgan":return{json:(await __vitePreload(()=>import("./index.3b668adc.js"),[])).default,relationship:relationships.mouthorgan};case"piano":return{json:(await __vitePreload(()=>import("./index.b7f1e2a7.js"),[])).default,relationship:relationships.piano};default:return null}};const container="_container_ajal8_1",changeIndex="_changeIndex_ajal8_6",activeopacity="_activeopacity_ajal8_1",leftrotates="_leftrotates_ajal8_1",rightrotates="_rightrotates_ajal8_1";var styles$1={container,changeIndex,activeopacity,leftrotates,rightrotates};const getImageSize=B=>new Promise((R,F)=>{const D=new Image;D.src=B,D.onload=()=>{R(D)},D.onerror=G=>R(D)}),formatFixedKey=(B,R)=>B==="piccolo"&&state$2.times[0]?ref(R+(1-state$2.times[0].octaveOffset)*12):ref(R),formatRelationship=(B,R)=>{let F=B[R]||B[0]||[];return typeof F[0]=="number"||typeof F[0]=="string"?[F]:typeof F[0]=="object"?F:[[]]},useFingeringSrc=(B,R,F)=>{const D=ref("");return B&&R==="trombone"&&!B.relationship[F]?(D.value=B.json.full2,D):(D.value=B.json.full,D)};var FingeringComponent=defineComponent({name:"fingering",props:{type:{type:String,default:""},fixedKey:{type:Number,default:0},fingeringInfo:{type:Object},loaded:{type:Function,default:()=>{}},viewInfo:{type:Object}},setup(B,{expose:R}){const F=toRefs(B),D=ref(null),G=ref(null),U=ref(0),W=ref(0);return R({container:D,containerWidth:U}),()=>{var j,Q,J,te,ne,ie,re,oe,le,fe,he,ge,ce,me,ye;if(!((j=F.viewInfo.value)!=null&&j.activeType))return null;const q=formatFixedKey((Q=B.fingeringInfo)==null?void 0:Q.name,F.fixedKey.value).value,Y=formatRelationship((te=(J=F.viewInfo.value)==null?void 0:J.activeType)==null?void 0:te.relationship,q||0),K=()=>{let ve=W.value===Y.length-1?0:W.value+1;W.value=ve},Z=Y[W.value]||[];return createVNode("div",{ref:D,class:classnames((ne=B.fingeringInfo)==null?void 0:ne.name,styles$1.container),style:{width:((ie=B.fingeringInfo)==null?void 0:ie.direction)==="vertical"?(re=B.fingeringInfo)==null?void 0:re.width:"",height:((oe=B.fingeringInfo)==null?void 0:oe.direction)==="transverse"?((le=B.fingeringInfo)==null?void 0:le.height)||"":"100%",display:"flex",paddingLeft:((fe=B.fingeringInfo)==null?void 0:fe.direction)==="vertical"?(he=B.fingeringInfo)==null?void 0:he.paddingLeft:"",paddingRight:((ge=B.fingeringInfo)==null?void 0:ge.direction)==="vertical"?(ce=B.fingeringInfo)==null?void 0:ce.paddingRight:""}},[Z.includes(0)?createVNode("span",{style:{position:"absolute",top:".5vh",right:".5vw",color:"rgb(1, 193, 181)",fontWeight:"bold"}},[createTextVNode("\u8F6C\u8C03")]):null,createVNode("img",{ref:G,src:(me=F.viewInfo.value)==null?void 0:me.fullsrc,style:{width:"auto",maxWidth:"100%",maxHeight:((ye=B.fingeringInfo)==null?void 0:ye.name)=="ukulele"?"110%":"100%"}},null),Z.map((ve,pe)=>{var xe,ue,_e,Be,Ae,Pe,Ie,Ce;const be=typeof ve=="string"?ve.replace("active-",""):String(ve);return createVNode("img",{"data-index":be,style:{position:"absolute",top:((xe=G.value)==null?void 0:xe.offsetTop)+"px",left:((ue=G.value)==null?void 0:ue.offsetLeft)+"px",zIndex:pe,height:((_e=G.value)==null?void 0:_e.height)+"px",width:((Be=G.value)==null?void 0:Be.width)+"px",maxWidth:"100%",maxHeight:((Ae=B.fingeringInfo)==null?void 0:Ae.name)=="ukulele"?"110%":"100%"},src:(Ce=(Ie=(Pe=F.viewInfo.value)==null?void 0:Pe.activeType)==null?void 0:Ie.json)==null?void 0:Ce[be]},null)}),Y.length>1?createVNode("div",{role:"button",onClick:K,class:["substituteFinger",styles$1.changeIndex]},[createTextVNode("\u66FF\u6307")]):null])}}});const formatdata={Flute:2,Clarinet:4,Trombone:14,Tuba:17,Trumpet:12,Horn:13,AltoSaxophone:6,TenorSaxophone:6,Saxophone:6,UpBassHorn:15,Melodica:137,HulusiFlute:136,PanFlute:135,Ocarina:134,Recorder:120,Ukulele:130,Mouthorgan:140,Piano:150};var formatId=B=>formatdata[B]||-1;const fingeringWidth=ref(0),fingeringStatus=ref("hidden"),fingeringViewInfo=async B=>{const R=B;if(R){const F=await getTypes(R.name);if(F){const D=formatFixedKey(R.name,state$2.fixedKey),G=useFingeringSrc(F,R.name,D.value),{width:U,height:W}=await getImageSize(G.value),q=document.getElementById("colexiu-detail-music-sheet").clientHeight||0,Y=state.evaluatingStatus?0:U,K=q/W;return fingeringWidth.value=q?K*Y:Y,U&&(fingeringStatus.value="show"),reactive({width:U,height:W,scale:K,usedFixedKey:D.value,fullsrc:G.value,activeType:F,detail:R})}}else fingeringStatus.value="hidden"},useFingering=async(B="")=>{const R=ref({}),F=ref({}),D=await fingeringViewInfo(typeById[formatId(B)]);return R.value=(D==null?void 0:D.activeType)||{},F.value=(D==null?void 0:D.detail)||{},[fingeringStatus,fingeringWidth,R,F]},ee=new EventEmitter;let playStartTime$1=0;class MultipleAudio{constructor(R){this.audios={},this.audioList=[],this.length=0,this.status="init",this.speed=90,this.muted=!1,this.audio=null,this.event=ee,this.currentTime=0,this.duration=0,this.timer=null,this.accelerateRefreshPlayer=()=>{if(this.timer)return;const F=this.currentTime;let D=new Date().getTime();this.timer=setInterval(()=>{this.currentTime=(new Date().getTime()-D)/1e3+F,this.event.emit("timeupdate",this)},10)},this.clearAccelerateRefreshPlayer=()=>{clearInterval(this.timer),this.timer=null},this.setVolume=(F,D)=>{let G=setInterval(()=>{Object.values(this.audios).map(U=>{F?(U.volume-=.01,U.volume<=.01&&(U.volume=0,clearInterval(G),D&&D())):(U.volume+=.01,U.volume>=1&&(U.volume=1,clearInterval(G),D&&D())),console.log(U.volume)})},16.7)},this.setSongs(R)}async setSongs(R){this.audioList=R.filter(G=>!!G).map(G=>G),this.audio=null,this.event.removeAllListeners(),this.audios={};const F=R.filter(G=>!!G).map(async G=>({url:G})),D=await Promise.all(F);for(const G of D){const U=new Audio(G.url);U.load(),this.audios[G.url]=U,this.audio||(this.audio=U)}this.length=F.length,this.audio&&(this.audio.addEventListener("loadedmetadata",G=>{this.setDuration()}),this.audio.addEventListener("timeupdate",G=>{var W;this.currentTime=((W=this.audio)==null?void 0:W.currentTime)||0,this.event.emit("timeupdate",G);let U=!1;this.currentTime===this.duration&&!U&&(U=!0)})),R.length&&(this.status=this.getStatus()),this.event.on("allWaiting",()=>{this.hasWaitng()&&this.event.emit("waiting")}),this.event.on("allPlaying",()=>{this.hasWaitng()||this.event.emit("playing")}),this.syncEvent()}setDuration(R){var D;const F=Object.values(R||this.audios||{});if(F.length){const G=[];for(const W of F){const q=W.duration;q>0&&G.push(q)}const U=Math.floor(Math.max(...G)-Math.min(...G));U>=1&&console.log("\u8BE5\u6559\u7A0B\u539F\u97F3\u4E0E\u4F34\u594F\u65F6\u957F\u8D85\u8FC7"+U+"\u79D2\uFF0C\u8BF7\u4FEE\u6539\u540E\u4F7F\u7528"),this.duration=Math.min(...G),this.duration>0&&((D=this.event)==null||D.emit("loadedmetadata",null,this.duration))}}destroyed(){this.pause(),this.event.removeAllListeners(),this.audio=null,this.audios={}}hasWaitng(){let R=!1;for(const F of Object.values(this.audios))if(F.dataset.status==="waiting"){R=!0;break}return R}syncEvent(){let R=!1;const F=q=>{var Y;R=!1,console.log("\u5F00\u59CB\u89E6\u53D1play\u4E8B\u4EF6",new Date().getTime()),this.event.emit("play",q),((Y=q.target)==null?void 0:Y.src)===this.audioList[0]&&(playStartTime$1=new Date().getTime())},D=async q=>{var Y;if(await this.pause(),this.event.emit("pause",q),((Y=q.target)==null?void 0:Y.src)===this.audioList[0]){const K=new Date().getTime()-playStartTime$1;this.event.emit("updatePlayTime",K/1e3)}},G=q=>{this.status==="play"&&(q.target.dataset.status="waiting"),this.event.emit("allWaiting")},U=q=>{q.target.dataset.status="",this.event.emit("allPlaying")},W=async q=>{R||(R=!0,await this.pause());for(const Y in this.audios)Object.prototype.hasOwnProperty.call(this.audios,Y)&&this.event.emit("ended",{target:this.audios[Y]})};for(const q of Object.values(this.audios))q.addEventListener("loadedmetadata",()=>this.setDuration(this.audios)),q.addEventListener("play",F),q.addEventListener("pause",D),q.addEventListener("waiting",G),q.addEventListener("playing",U),q.addEventListener("ended",W)}getStatus(){var R;return this.audio?(R=this.audio)!=null&&R.paused?"pause":"play":"init"}play(R){return this.getStatus()!=="play"?new Promise(F=>{setTimeout(()=>{new Date().getTime(),Object.values(this.audios).map(async(D,G)=>{console.log("play duration",D.duration),await D.play()}),F(this.audios)},R||100)}):(this.status=this.getStatus(),Promise.resolve())}pause(){return this.status=this.getStatus(),Promise.all(Object.values(this.audios).map(async R=>await R.pause())).then(R=>(this.status=this.getStatus(),R))}setMute(R,F){F?this.audios[F]&&(this.audios[F].muted=R):(this.muted=R,Object.values(this.audios).map(D=>D.muted=R))}setSpeed(R,F){F?this.audios[F]&&(this.audios[F].playbackRate=R):(this.speed=R,Object.values(this.audios).map(D=>(D.playbackRate=R,D)))}setCurrentTime(R){this.currentTime=R,Object.values(this.audios).map(F=>F.currentTime=R)}toggleMute(R){R?this.audios[R]&&(this.audios[R].muted=!this.audios[R].muted):(Object.values(this.audios).map(F=>F.muted=!this.muted),this.muted=!this.muted)}async togglePlay(R){if(this.getStatus()==="pause")return await this.play(R);if(this.getStatus()==="play")return this.setMute(!0),await this.pause()}}const search=useOriginSearch(),skpList=["Ukulele"],useXml=async(B,R)=>{let F=ref("");try{const D=await request$1$1(B),G=getCustomInfo(D);if(skpList.includes(G.code))F.value=D;else{F.value=formatXML(G.parsedXML,{title:R.musicSheetName});const U=Number(search["part-index"])||0;F.value=onlyVisible(F.value,U)}}catch{}return F},useMp3s=async B=>{var Y;const F=useOriginSearch()["part-index"]||0,D=(Y=B.background)==null?void 0:Y[F];state.songs={background:encodeURI(B.audioFileUrl||B.metronomeUrl||B.url||""),music:encodeURI((D==null?void 0:D.audioFileUrl)||(D==null?void 0:D.metronomeUrl)||"")},console.log("backgroundUrl",state.songs.background),console.log("musicUrl",state.songs.music),state$2.isAppPlay=B.audioType==="MIDI";let G={skipTick:!1,repeatedBeats:!0,scoreSize:"middle"},U={};state$2.activeDetail={...B,examSongId:B.id,originalSpeed:90,isAppPlay:B.audioType==="MIDI",extConfigJson:{...G}},state$4.sett.hertz=B.aiDefaultFrequency&&parseInt(""+B.aiDefaultFrequency||"440")||440;try{U=JSON.parse((B==null?void 0:B.extConfigJson)||"")}catch{}state$2.activeDetail.extConfigJson={...state$2.activeDetail.extConfigJson,...U};const W=state$2.activeDetail.extConfigJson.scoreSize,q=store_legacy.get("zooms")||{};W&&!q[""+B.id]&&(store_legacy.set("zooms",{...q,[""+B.id]:W}),state$4.sett.scoreSize=W),state$2.needTick=B.audioType==="MP3"&&B.mp3Type==="MP3"||B.audioType==="MIDI",state$2.skipTick=state$2.activeDetail.extConfigJson.skipTick,state$2.repeatedBeats=state$2.activeDetail.extConfigJson.repeatedBeats,state.songs.music||changeMode("background"),state.audiosInstance||(state.audiosInstance=new MultipleAudio(Object.values(state.songs)))},useSpecialShapedScreen=()=>{const B=ref(0);return postMessage({api:"isSpecialShapedScreen"},R=>{const F=R==null?void 0:R.content.notchHeight;state$2.notchHeight=(browser().ios?F*2:F)||((R==null?void 0:R.content.isSpecialShapedScreen)&&browser().ios?100:0),B.value=state$2.notchHeight,state$2.isSpecialShapedScreen=R==null?void 0:R.content.isSpecialShapedScreen}),[B]},useDetail=B=>{const R=getRequestHostname(),F=ref("loading"),D=ref({});return F.value="loading",request.get(`/musicSheet/detail/${B}`,{prefix:R}).then(G=>{useMp3s(G.data),D.value={...G.data},D.value.notation==0&&(state$4.sett.type="staff"),state$2.subjectId=(G.data.musicSubject||"").split(",")[0]||0,window.DYSubjectId=formatId(G.data.code),F.value="success"}).catch(()=>F.value="error"),[F,D]},useSuspendPlay=()=>{listenerMessage("suspendPlay",()=>{state$2.activeTick>-1&&stopTick(),console.log(state.playState),state.playState==="play"&&(resetPlayStatus(),state.evaluatingStatus&&evaluatStopPlay(!1))})},event=new EventEmitter,browserInfo=browser(),initBehaviorId=""+new Date().valueOf(),getLinkId=()=>{const B=useOriginSearch().id;return location.hash.split("?")[0].split("/").pop()||B||""},getFixTime=B=>{const R=getDuration(state.osmd);let F=R.numerator||0,D=R.denominator||4;return state$2.repeatedBeats&&(F=F===2?4:F),!state$2.needTick&&!state$2.skipTick?D*60/B/D*F:0};let prevIndex=0;const state=reactive({songs:{},playState:"init",sectionHint:new SectionHint,audiosInstance:null,mode:"music",isFirstPlay:!0,metro:null,metroing:!1,duration:"0:00",durationNum:0,currentTime:"0:00",currentTimeNum:0,loading:!1,speed:90,browser:browser(),speedShow:!1,progressShow:!1,touched:!1,osmd:null,tickPlayer:null,evaluatingStatus:!1,evaluatingTips:!1,clickTime:0,evaluatingFixTime:0,cameraStatus:!1,captureStatus:!1,ticking:!1,partIndex:0,activeIndex:0}),syncStepIndex=B=>{var R;state.osmd.hidden!==!1&&state.osmd.cursor.show(),prevIndex=B,setStepIndex(state.osmd,B),refreshIndex((R=state$2.times[B])==null?void 0:R.time)};watchEffect(()=>{state$2.maskStatus=state.playState==="play"});const syncPlayState=async()=>{if(state$2.activeDetail.isAppPlay){const B=await promisefiyPostMessage({api:"cloudGetMediaStatus"}),R=B==null?void 0:B.content.status;state.playState=R}else state.playState=state.audiosInstance.getStatus()},setCurrentTime=B=>{console.log("setCurrentTime",B);const R=B;state$2.fixedKey=0,state.currentTimeNum=R,state.currentTime=formatTime(R),state$2.activeDetail.isAppPlay?promisefiyPostMessage({api:"cloudSetCurrentTime",content:{currentTime:B*1e3,songID:state$2.activeDetail.examSongId}}):state.audiosInstance.setCurrentTime(R),refreshView(),syncPlayState();const F=getIndex(state$2.times,state.currentTimeNum);syncStepIndex(F)},getActiveMidiId=()=>{var B,R,F,D,G,U,W;return(W=(U=(G=(D=(F=(R=(B=state.osmd)==null?void 0:B.sheet)==null?void 0:R.instruments)==null?void 0:F[0])==null?void 0:D.subInstruments)==null?void 0:G[0])==null?void 0:U.midiInstrumentID)!=null?W:0},changeMode=async B=>{var F,D;const R=B==="background"?"music":"background";if(console.log(!state.songs[B],B,R),state$2.activeDetail.isAppPlay){const G=new Map;for(const U of state$2.partListNames)G.set(U,60);for(const U of getVoicePartInfo().partListNames)G.set(U,R==="background"?100:0);promisefiyPostMessage({api:"cloudVolume",content:{activeMidiId:getActiveMidiId(),activeMidiVolume:R==="background"?100:0,parts:Array.from(G.keys()).map(U=>({name:U,volume:G.get(U)}))}})}state.mode=B,(F=state.audiosInstance)==null||F.setMute(!0,state.songs[R]),(D=state.audiosInstance)==null||D.setMute(!1,state.songs[B])},changeAllMode=()=>{var B,R;if((B=state$2.activeDetail)!=null&&B.isAppPlay){const F=new Map;for(const D of state$2.partListNames)F.set(D,1);promisefiyPostMessage({api:"cloudVolume",content:{activeMidiId:getActiveMidiId(),activeMidiVolume:100,parts:Array.from(F.keys()).map(D=>({name:D,volume:F.get(D)}))}})}else state.mode="background",(R=state.audiosInstance)==null||R.setMute(!0)},changeSpeed=(B,R=!0)=>{var D;const F=store_legacy.get("speeds")||{};R&&(F[getLinkId()]=B,store_legacy.set("speeds",F)),state.speed=B,state$2.activeDetail&&((D=state.audiosInstance)==null||D.setSpeed(B/state$2.baseSpeed),promisefiyPostMessage({api:"cloudChangeSpeed",content:{speed:B,originalSpeed:state$2.activeDetail.originalSpeed,songID:state$2.activeDetail.examSongId}}),state.playState==="play"&&syncStepIndex(getIndex(state$2.times,state.currentTimeNum)))},resetCursor=()=>{state.osmd&&(state.osmd.product?state.osmd.cursor.setPosition({...state$2.times[0].cursorBox}):state.osmd.cursor.reset(),state.osmd.cursor.hide(),state$2.fixedKey=0)},refreshIndexBase=B=>{if(B<0)return;const{osmd:R}=state;R&&state$2.times[B]&&(state$2.sectionStatus||state.sectionHint.show(),state$2.times[B]&&state$2.times[B].noteElement&&state.sectionHint.showForElement(state$2.times[B]),R.product||R.cursor.hidden!==!1&&(R.cursor.reset(),R.cursor.show(),state$2.fixedKey=0),prevIndex!==B&&(setStepIndex(state.osmd,state$2.times[B].i,prevIndex),prevIndex=B),state$2.fixedKey=state$2.times[B].realKey,state$2.activeNote=state$2.times[B])},refreshIndex=B=>{const{osmd:R}=state;if(R&&(B||state.audiosInstance.audio)){const F=B||state.audiosInstance.audio.currentTime,D=getIndex(state$2.times,F);state.activeIndex=D,removeRepateBackground(D);const G=state$2.times[state$2.times.length-1],U=(G==null?void 0:G.sourceEndTime)||(G==null?void 0:G.endtime);F>U?(state.osmd.cursor.hide(),state.sectionHint.destroy()):state$2.times[D]&&refreshIndexBase(D)}},removeRepateBackground=B=>{var R,F;if(state.evaluatingStatus&&B){const D=state$2.times[B],G=state$2.times[B+1]||D,U=(F=(R=G==null?void 0:G.noteElement)==null?void 0:R.sourceMeasure)==null?void 0:F.measureListIndex;G&&state$2.evaluatings[U]&&B>0&&(state$2.evaluatings={...state$2.evaluatings,[U]:void 0})}},refreshPlayer=async B=>{var F,D;const{osmd:R}=state;if(R&&(B||state.audiosInstance.audio)){const G=B||state.audiosInstance.audio.currentTime,U=0;if(G+1{if(state$2.sectionStatus&&state$2.section.length===2){G>=state$2.section[0].time&&(state$2.sectionFlash=!1);const Y=state$2.times[state$2.section[1].i+1],K=Y?Y.halfTone===0?state$2.section[1].endtime:Y.time:state.durationNum;return G+(browserInfo.xiaomi?.2:.08)>=K}return!1})()){state.audiosInstance.setMute(!0),state.osmd.cursor.hide(),(F=state$2.activeDetail)!=null&&F.isAppPlay?pause():await state.audiosInstance.pause(),setSectionModeCurrentTime(),clearAccelerateRefreshPlayer(),setTimeout(()=>setPlayState(),1e3),state.loading=!1;return}((D=state$2.activeDetail)==null?void 0:D.isAppPlay)&&state.durationNum+3{try{prevIndex=0,state.osmd.cursor.reset(),state.osmd.cursor.hide(),state$2.fixedKey=0,state$2.sectionFlash=!1,state.sectionHint&&state.sectionHint.destroy(),B||(state$2.activeDetail.isAppPlay?(await promisefiyPostMessage({api:"cloudSuspend",content:{songID:state$2.activeDetail.examSongId}}),endCapture()):(console.log("resetPlayStatus\u8C03\u7528\u6682\u505C"),state.audiosInstance.pause())),syncPlayState()}catch(R){console.log("resetPlayStatus\u9519\u8BEF",R)}},play=async()=>{state.isFirstPlay&&(resetPlayStatus(),state$2.fixedKey=0),state$2.activeDetail.isAppPlay?(await syncPlayState(),promisefiyPostMessage({api:"cloudSuspend",content:{songID:state$2.activeDetail.examSongId}}),startCapture()):(state.playState=state.audiosInstance.getStatus(),clearAccelerateRefreshPlayer(),accelerateRefreshPlayer(),startCapture())},setDelayTime=async B=>new Promise(R=>{setTimeout(()=>{R(B)},B)}),pause=async()=>{state$2.sectionStatus&&state.osmd.cursor.hide(),state$2.activeDetail.isAppPlay?(await syncPlayState(),await promisefiyPostMessage({api:"cloudSuspend"}),await setDelayTime(200),endCapture()):(state.playState=state.audiosInstance.getStatus(),clearAccelerateRefreshPlayer(),state.audiosInstance.pause(),setTimeout(()=>{endCapture()},200))},waiting=()=>{state.loading=!0},playing=()=>{state.loading=!1},ended=lodash.exports.debounce(async B=>{resetPlayStatus(),state$2.fixedKey=0,state.evaluatingStatus||(refreshPlayer(0),state$4.sett.loop&&await setPlayState()),setCurrentTime(0),event.emit("ended",B)},300,{leading:!0,trailing:!1});let timer=null;const accelerateRefreshPlayer=()=>{timer||!state.audiosInstance||(timer=setInterval(()=>{requestAnimationFrame(()=>{refreshPlayer(),state.audiosInstance.getStatus()==="play"&&refreshIndex()})},16.7))},clearAccelerateRefreshPlayer=()=>{clearInterval(timer),timer=null},sectionChange=()=>{state$2.sectionStatus=!state$2.sectionStatus,clearAccelerateRefreshPlayer(),resetPlayStatus(),state$2.sectionStatus||(setCurrentTime(0),state$2.fixedKey=0),state$2.sectionStatus&&state$2.section.length!=2&&resetCursor()},getFirsrNoteByMeasureListIndex=(B,R=!0)=>{var F,D,G;for(const U of state$2.times)if(((D=(F=U==null?void 0:U.noteElement)==null?void 0:F.sourceMeasure)==null?void 0:D.measureListIndex)===B){let W=null;for(const q of U.measures)getSlursNote(q)&&(W=getSlursNote(q));if(W&&((G=W.sourceMeasure)==null?void 0:G.measureListIndex)!==B){for(const q of state$2.times)if(q.noteElement.NoteToGraphicalNoteObjectId===W.NoteToGraphicalNoteObjectId)return q}return U}return null},setSectionModeCurrentTime=()=>{var B,R;if(console.log(state$2.needTick,"setSectionModeCurrentTime"),state$2.needTick)setCurrentTime(state$2.section[0].sourceStartTime||state$2.section[0].time);else{const F=(R=(B=state$2.section[0].noteElement)==null?void 0:B.sourceMeasure)==null?void 0:R.measureListIndex;F>0?(setCurrentTime(getFirsrNoteByMeasureListIndex(F-1).time),state$2.sectionFlash=!0):setCurrentTime(0)}},setPlayerView=()=>{console.log(state$2.sectionStatus,"detailState.sectionStatus"),console.log(state$2.needTick),state$2.sectionStatus&&(syncStepIndex(getIndex(state$2.times,state.currentTimeNum)),state$2.section.length===2?setSectionModeCurrentTime():(state$2.section=[],state$2.sectionBoundingBoxs=[],state$2.sectionStatus=!1,Toast.clear()))},cloudToggleState=async()=>{const B=await promisefiyPostMessage({api:"cloudGetMediaStatus"}),R=B==null?void 0:B.content.status;if(R==="init")return;R==="suspend"?(await promisefiyPostMessage({api:"cloudPlay",content:{songID:state$2.activeDetail.examSongId,startTime:state.currentTimeNum*1e3,originalSpeed:state$2.activeDetail.originalSpeed,speed:state.speed,hertz:440}}),startCapture()):(await promisefiyPostMessage({api:"cloudSuspend"}),endCapture());const F=await promisefiyPostMessage({api:"cloudGetMediaStatus"});state.playState=F==null?void 0:F.content.status,console.log(F,"cloudGetMediaStatused")},toggleState=async B=>{state$2.activeDetail.isAppPlay?await cloudToggleState():(console.log(state$2.activeDetail),console.log("delay",B),state.isFirstPlay=!1,setPlayerView(),await state.audiosInstance.togglePlay(B),state.evaluatingStatus||changeMode(state.mode),state.playState=state.audiosInstance.getStatus())},setActiveKey=B=>{state$2.activeTick=B},setTickStop=()=>{console.log("\u8282\u62CD\u5668\u7ED3\u675F",new Date().getTime()-state.clickTime),state$2.activeTick=-1,state$2.activeTickRepeat=1,toggleState(getTickTime(state.speed/state$2.baseSpeed))};let timeliner=-1;const clearIntervalTimeline=()=>{clearInterval(timeliner)},onTickDestroy=()=>{event.emit("tickDestroy")},setTick=(B,R)=>{var D,G,U,W,q,Y,K;console.log("ticking");const F=()=>{B(),event.emit("tickEnd")};if(state$2.needTick){let{numerator:Z,denominator:j}=getDuration(state.osmd);if(state.osmd.numerator&&state.osmd.denominator&&(Z=state.osmd.numerator,j=state.osmd.denominator),state$2.activeDetail.isAppPlay)state.ticking=!0,postMessage({api:"cloudMetronome",content:{repeat:Z===2?2:1,denominator:j,numerator:Z}},Q=>{state.ticking=!1,(Q==null?void 0:Q.content.status)==="finish"?F():(Q==null?void 0:Q.content.status)==="cancel"&&event.emit("tickDestroy")});else{const Q=Z===2?2:1;state$2.activeTickRepeat=Q,console.log("ticking"),state.tickPlayer=new Player(Z,(R||state.speed)/90),(D=state.tickPlayer)==null||D.start(Z,(R||state.speed)/90,Q),(G=state.tickPlayer)==null||G.event.off("tick",setActiveKey),(U=state.tickPlayer)==null||U.event.off("stop",F),(W=state.tickPlayer)==null||W.event.off("destroy",onTickDestroy),(q=state.tickPlayer)==null||q.event.on("tick",setActiveKey),(Y=state.tickPlayer)==null||Y.event.on("stop",F),(K=state.tickPlayer)==null||K.event.on("destroy",onTickDestroy)}}else F()},setPlayState=async()=>{if(!(state$2.activeTick>-1||state.ticking)){if(await syncPlayState(),console.table({playState:state.playState,currentTime:state.currentTimeNum}),state.playState!=="pause"&&state.playState!=="suspend"){await toggleState();return}console.log("\u8BBE\u7F6E\u64AD\u653E"),setPlayerView(),setTick(setTickStop)}},stopTick=()=>{state.tickPlayer&&state.tickPlayer.destroy(),event.emit("stopTick"),state$2.activeTickRepeat=1,state$2.activeTick=-1},windowResize=()=>{const B=getIndex(state$2.times,state.currentTimeNum);setTimeout(()=>{var R,F;(F=state.sectionHint)==null||F.showForElement((R=state$2.times[B])==null?void 0:R.noteElement)},200)},loadedmetadata=()=>{state.duration=formatTime(state.audiosInstance.duration),state.durationNum=state.audiosInstance.duration};let prevDiff=0,viewing=!1;const refreshView=()=>{var D;let B,R;(D=state==null?void 0:state.osmd)!=null&&D.product&&(B=state.osmd.cursor.img,R=document.querySelector("#colexiu-detail-music-sheet"));const F=Math.max(parseFloat((B||state.osmd.cursor.cursorElement).style.top),0);Math.abs(prevDiff-F)>10&&!viewing&&(viewing=!0,setTimeout(()=>{viewing=!1,(R||(state$3.clintNmae==="colexiu"?state.osmd.container.parentElement.parentElement:state.osmd.container.parentElement)).scrollTo({top:F,left:0,behavior:"smooth"}),prevDiff=F},100))},updatePlayTime=async B=>{if(!state.evaluatingStatus){const R=useOriginSearch(),F=sessionStorage.getItem("behaviorId")||R.behaviorId||initBehaviorId,D=getRequestHostname(),G=useClientType();console.log("\u{1F680} ~ clientType",G);const U=R.feature||"PRACTICE";if(G==="web")return;try{const W=await request.post("/musicPracticeRecord/save",{prefix:D,requestType:"json",data:{musicSheetId:getLinkId(),sysMusicScoreId:getLinkId(),feature:U,playTime:B,deviceType:getPlatform(),behaviorId:F}});event.emit("updatePlayTimeSuccess",W.data)}catch{}if(R.lessonTrainingId)try{console.log(D);const W=await request.post("/studentLessonTraining/lessonTrainingRecord",{prefix:D,requestType:"json",data:{materialType:"SONG",record:{clientType:G==null?void 0:G.toLocaleUpperCase(),feature:"LESSON_TRAINING",deviceType:browserInfo.android?"ANDROID":browserInfo.isApp?"IOS":"WEB",behaviorId:F,playTime:B,musicSheetId:getLinkId()},courseScheduleId:R.courseScheduleId,lessonTrainingId:R.lessonTrainingId,materialId:R.materialId}})}catch{}}},setAudioInit=()=>{state.audiosInstance.event.on("loadedmetadata",loadedmetadata),state.audiosInstance.event.on("waiting",waiting),state.audiosInstance.event.on("playing",playing),state.audiosInstance.event.on("play",play,!1),state.audiosInstance.event.on("pause",pause,!1),state.audiosInstance.event.on("ended",ended,!1),state.audiosInstance.event.on("updatePlayTime",updatePlayTime,!1),listenerMessage("cloudplayed",async()=>{await syncPlayState(),state.currentTimeNum=0,state.currentTime="00:00",state.audiosInstance.event.emit("ended",new Event("ended"))}),listenerMessage("cloudTimeUpdae",B=>{const R=(B==null?void 0:B.content.currentTime)/1e3;state.playState==="play"&&(state.currentTimeNum=R,state.currentTime=formatTime(R),refreshPlayer(R),refreshIndex(R)),refreshView()}),state.audiosInstance.event.on("timeupdate",()=>{state.currentTimeNum=state.audiosInstance.currentTime,state.currentTime=formatTime(state.audiosInstance.currentTime),requestAnimationFrame(()=>{state.audiosInstance.getStatus()==="play"&&refreshPlayer(),refreshView()})}),window.addEventListener("resize",windowResize)},setStepView=(B,R)=>{prevIndex=Math.max(B.i,0),syncStepIndex(B.i),R&&refreshPlayer(R),refreshView()},noteClick=B=>{if(state.isFirstPlay){Toast("\u5F00\u59CB\u64AD\u653E\u540E\u624D\u80FD\u8C03\u6574\u8FDB\u5EA6");return}let R=getNoteBySlursStart(getActtiveNoteByTimes(B));if(R){const F=R.sourceStartTime||R.time;setCurrentTime(F),setStepView(R.i,F),state$2.fixedKey=R.realKey,state$2.activeNote=R}};let playStartTime=0;const startCapture=async()=>{var B;(B=state$2.activeDetail)!=null&&B.isAppPlay&&(playStartTime=new Date().getTime(),console.log("startCapture",playStartTime)),state$4.sett.camera&&browserInfo.isApp&&!state.captureStatus&&state.evaluatingStatus&&state$4.eva.save&&(state.captureStatus=!0,postMessage({api:"startCapture"},()=>{postMessage({api:"setCaptureMode",content:{mode:"evaluating"}})}))},endCapture=async()=>{var B,R;if((B=state$2.activeDetail)!=null&&B.isAppPlay){const F=new Date().getTime()-playStartTime;playStartTime!==0&&F>0&&((R=state.audiosInstance)==null||R.event.emit("updatePlayTime",F/1e3),playStartTime=0)}browserInfo.isApp&&state.evaluatingStatus&&state$4.sett.camera&&state.captureStatus&&(postMessage({api:"endCapture"},()=>{state.captureStatus=!1}),evaluatPlayerStop())},setCaptureMode=async()=>{browserInfo.isApp&&state$4.sett.camera&&postMessage({api:"setCaptureMode",content:{mode:state.evaluatingStatus?"evaluating":"practice"}})},section="_section_fxysl_1",measure="_measure_fxysl_1",dontTransition="_dontTransition_fxysl_5",after="_after_fxysl_5",img="_img_fxysl_22",font="_font_fxysl_30",bad="_bad_fxysl_35",good="_good_fxysl_43",great="_great_fxysl_51",perfect="_perfect_fxysl_58",noteWrap="_noteWrap_fxysl_80",noteBase="_noteBase_fxysl_86",noteRight="_noteRight_fxysl_89",noteError="_noteError_fxysl_92",flash="_flash_fxysl_124",restFlag="_restFlag_fxysl_127",restFlagActive="_restFlagActive_fxysl_141",flicker="_flicker_fxysl_1";var styles={section,measure,dontTransition,after,img,font,bad,good,great,perfect,noteWrap,noteBase,noteRight,noteError,flash,restFlag,restFlagActive,flicker};const restPromptData=reactive({list:[]}),restPromptMain=B=>{calculateMergeRest(B)};function calculateMergeRest(B){var U,W,q,Y,K,Z,j,Q,J;const R=[],F=document.querySelector("#osmdSvgPage1"),D=((U=F.getAttribute("viewBox"))==null?void 0:U.split(" "))||[];let G=Number(F.getAttribute("width"))/Number(D[2]);G=isNaN(G)?1:G;for(let te=0;tefe.measureNumberXML===ie)&&oe&&re>1){const fe=getStaveBox((J=(Q=ne==null?void 0:ne.stave)==null?void 0:Q.attrs)==null?void 0:J.id,G);R.push({measureNumberXML:ie,allRests:oe,multipleRestMeasures:re,staveBox:fe})}}restPromptData.list=R}function getStaveBox(B,R){var D;if(!B)return{};const F=document.querySelector("#"+B);if(F){const G=(D=F==null?void 0:F.nextElementSibling)==null?void 0:D.getBBox();return{left:G.x*R+"px",top:G.y*R+"px",width:G.width*R+"px",height:G.height*R+"px"}}return{}}function _isSlot(B){return typeof B=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!isVNode(B)}const sectionRef=ref(null),noteInfoItems=reactive({duration:!1,numerator:!1,denominator:!1,i:!1,time:!1,speed:!1});window.setNoteInfoItems=B=>{for(const R in B)Object.prototype.hasOwnProperty.call(B,R)&&(noteInfoItems[R]=B[R])};const uniqueByPosition=B=>{const R={};for(const F of B)F&&F.start_x&&(R[`${F.x}-${F.y}`]=F);return R};watchEffect(()=>{state$2.sectionStatus?state$2.section.length?state$2.section.length===1&&(Toast.clear(),Toast({duration:0,message:"\u8BF7\u9009\u62E9\u7ED3\u675F\u8282\u70B9",position:"top"})):(state$2.befireSection=null,Toast.clear(),Toast({duration:0,message:"\u8BF7\u9009\u62E9\u5F00\u59CB\u8282\u70B9",position:"top"})):(state$2.section=[],state$2.sectionBoundingBoxs=[],Toast.clear())});var Section=defineComponent({name:"section-box",props:{type:{type:String,default:"evaluating"},top:{type:Number,default:0},left:{type:Number,default:0}},data(){return{sectionTop:0,sectionLeft:0}},methods:{getBoundingBoxByNote(B,R){var G,U,W,q,Y,K,Z,j,Q,J,te;const F=(W=(U=(G=B.sourceMeasure)==null?void 0:G.verticalMeasureList)==null?void 0:U[0])==null?void 0:W.boundingBox;if(!F)return null;const D={...F.absolutePosition,...F.size,...R};return D.x=D.x*10,D.y=D.y*10,D.width=D.width*10,D.height=D.height*10,(Z=(K=(Y=(q=B==null?void 0:B.sourceMeasure)==null?void 0:q.verticalMeasureList)==null?void 0:Y[0])==null?void 0:K.stave)!=null&&Z.height&&(D.height=(te=(J=(Q=(j=B.sourceMeasure)==null?void 0:j.verticalMeasureList)==null?void 0:Q[0])==null?void 0:J.stave)==null?void 0:te.height),D},setSettionBackground(){var U,W,q,Y,K;state$2.sectionBoundingBoxs=[];const[B,R]=state$2.section.sort((Z,j)=>Z.i-j.i),F=Math.abs(R.i-B.i)+1;R.noteLength;const D=[],G=[];for(let Z=0;Z(Z.height=Math.max(...G),Z))},setSection(B){const R=getActtiveNoteByTimes(B);if(console.log("\u{1F680} ~ activeNote",R),R&&state$2.section.length<2){const F=state$2.section.length;if(F===0){const D=getNoteBySlursStart(R,!0);state$2.section.push(state$2.times[D.i-D.si])}if(F===1){const D=getNoteBySlursStart(R,!0,"end");state$2.section.push(state$2.times[D.i-D.si+D.noteLength-1])}}state$2.section.length===2&&(Toast.clear(),this.setSettionBackground())},sectionClick(B){if(state$2.sectionStatus)this.setSection(B);else{if(state$2.mode!=="contact"||state.evaluatingStatus)return;event$1.emit("section-click",B)}},filterTimes(B){const R=[];return B.filter(F=>{const D=R.includes(F.id);return R.push(F.id),!D})}},mounted(){var B,R;Toast.clear(),state$2.section=[],this.sectionTop=(B=sectionRef.value)==null?void 0:B.getBoundingClientRect().top,this.sectionLeft=(R=sectionRef.value)==null?void 0:R.getBoundingClientRect().left},beforeUnmount(){Toast.clear(),state$2.sectionStatus=!1,state$2.section=[]},render(){var W,q,Y;let B;const R=state$4.sett.eyeProtection?"var(--eye-section-border-color)":"var(--section-border-color)",F=K=>state$4.sett.eyeProtection?K.before?"var(--section-background-color)":"var(--eye-section-background-color)":K.before?"var(--eye-section-background-color)":"var(--section-background-color)",D=((Y=(q=(W=state$2.times[state.activeIndex])==null?void 0:W.noteElement)==null?void 0:q.sourceMeasure)==null?void 0:Y.MeasureNumberXML)||-2,G=restPromptData.list.find(K=>{const Z=D-K.measureNumberXML;return K.allRests&&Z>=0&&Z{var ie,re,oe,le;if(!K.svgElelent)return null;let Z;try{Z=K.svgElelent.bbox||((re=(ie=K.svgElelent).getBoundingBox)==null?void 0:re.call(ie)),!Z&&((le=(oe=K.svgElelent)==null?void 0:oe.attrs)==null?void 0:le.el)&&(Z=K.svgElelent.attrs.el.getBBox(),Z.w=Z.width<15?15:Z.width,Z.h=Z.height<11?11:Z.height)}catch(fe){console.log(fe)}if(!Z)return null;state$4.sett.type==="jianpu"&&K.svgElelent&&K.svgElelent.top_y&&K.svgElelent.note_height&&(Z.y=K.svgElelent.top_y-K.svgElelent.note_height);let{x:j,y:Q,h:J,w:te}=Z,ne=null;return K.si===0&&(ne=this.getBoundingBoxByNote(K.noteElement)),createVNode(Fragment,null,[K.si===0&&ne&&createVNode("div",{"data-id":K.id,style:{position:"absolute",top:formatZoom(ne.y)+"px",left:formatZoom(ne.x)+"px",height:formatZoom(ne.height)+"px",width:formatZoom(ne.width)+"px"},onClick:state$2.sectionStatus?this.sectionClick:void 0},null),createVNode("div",{"data-id":K.id,"data-vf":"vf"+K.id,class:styles.noteWrap,style:{position:"absolute",top:formatZoom(Q)+"px",left:formatZoom(j)+"px",height:formatZoom(J)+"px",width:formatZoom(te)+"px",background:Object.values(noteInfoItems).find(fe=>fe===!0)?"rgba(255, 255, 255, 0.8)":""},onClick:this.sectionClick},[noteInfoItems.duration&&createVNode(Fragment,null,[parseInt(K.duration*100+"")/100,createVNode("br",null,null)]),noteInfoItems.time&&createVNode(Fragment,null,[K.time.toFixed(2),createVNode("br",null,null)]),noteInfoItems.numerator&&createVNode(Fragment,null,[K.noteElement.sourceMeasure.activeTimeSignature.numerator,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.denominator&&createVNode(Fragment,null,[K.noteElement.sourceMeasure.activeTimeSignature.denominator,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.i&&createVNode(Fragment,null,[K.i,createVNode("br",null,null),createVNode("br",null,null)]),noteInfoItems.speed&&createVNode(Fragment,null,[K.speed.toFixed(0),createVNode("br",null,null),createVNode("br",null,null)]),createVNode("div",{class:[styles.noteBase,styles.noteRight]},[createVNode(Icon,{name:"success",size:"16",color:"var(--primary-color)"},null)]),createVNode("div",{class:[styles.noteBase,styles.noteError]},[createVNode(Icon,{name:"cross",size:"16",color:"red"},null)])])])}),state$2.section.map((K,Z)=>{var J;const j=getBoundingBoxByverticalNote(K);let Q;try{const te=K.svgElelent.bbox||((J=K.svgElelent)==null?void 0:J.getBoundingBox());Q=formatZoom((te==null?void 0:te.x)||(Z===0?j.start_x:j.end_x))}catch(te){console.log(te)}return Q?Z===0&&j?createVNode("div",{style:{position:"absolute",top:formatZoom(j.y)-5+"px",left:formatZoom(j.x)+"px",height:formatZoom(j.height)+"px",border:`5px solid ${R}`,borderColor:`${R} transparent ${R} ${R}`,borderRight:"none",width:"5px"}},null):Z===1&&j?(j.width=formatZoom(Q-j.x+15),createVNode("div",{style:{position:"absolute",top:formatZoom(j.y-5)+"px",left:formatZoom(j.end_x-3)-5+"px",height:formatZoom(j.height)+"px",border:`5px solid ${R}`,borderColor:`${R} ${R} ${R} transparent`,borderLeft:"none",width:"5px"}},null)):null:null}),state$2.sectionBoundingBoxs.map(K=>{var Z;return createVNode("div",{class:{[styles.flash]:K.before&&state$2.sectionFlash&&state.playState==="play"},style:{position:"absolute",top:formatZoom(K.y)+"px",left:formatZoom(K.x)+"px",height:formatZoom((Z=getBoundingBoxByverticalNote(state$2.section[0]))==null?void 0:Z.height)+"px",width:formatZoom(K.width)+"px",backgroundColor:F(K)}},null)}),createVNode(TransitionGroup,{name:"list",duration:800},_isSlot(B=Object.values(uniqueByPosition(Object.values(state$2.evaluatings))).map(K=>K?createVNode("div",{key:K.y+K.x+K.text,class:classnames(styles[K.text],styles.measure,{[styles.dontTransition]:K.dontTransition}),style:{position:"absolute",top:formatZoom(K.y)+this.top+"px",left:formatZoom(K.x)+this.left+"px",height:formatZoom(K.height)+"px",width:formatZoom(K.width)+"px"}},[this.type==="evaluating"?createVNode("span",{class:styles.after},[createVNode("span",{class:styles.img},null),createVNode("span",{class:styles.font},[K.score])]):null]):createVNode("span",null,null)))?B:{default:()=>[B]}),G&&createVNode("div",{class:["dotWrap",styles.restMeasure],style:G.staveBox},[createVNode("div",{class:"dot"},[U])])])}});class Cursor{constructor(R){this.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAABCAYAAAASC7TOAAAAAXNSR0IArs4c6QAAABdJREFUGFdj3Pp5c0Ptm2oGdNAs0soAAHslBd3n2kNUAAAAAElFTkSuQmCC",this.x=R.x,this.y=R.y,this.width=R.w,this.height=R.h,this.img=document.createElement("img"),this.img.src=this.src,this.img.style.position="absolute",this.img.style.zIndex="-1",this.setValue()}reset(){var F,D;const R=(D=(F=state$2.times)==null?void 0:F[0])==null?void 0:D.cursorBox;R&&this.setPosition(R)}show(){this.img.style.display=""}hide(){this.img.style.display="none"}setPosition({x:R,y:F,w:D,h:G}){this.x=R,this.y=F,this.width=D,this.height=G,this.setValue()}setValue(){this.img.style.left=this.x+"px",this.img.style.top=this.y+"px",this.img.style.width=this.width+"px",this.img.style.height=this.height+"px",this.show()}}const rendered=ref(!1);var MusicSheet=defineComponent({name:"music-score",props:{isSoundEffect:{type:Boolean,default:!1},score:{type:String,default:""},showPartNames:{type:Boolean,default:!1},opotions:{type:Object,default:()=>{}},EngravingRules:{type:Object,default:()=>{}},showSection:{type:Boolean,default:!0}},emits:["rerender","startRender","renderError","loaddingEnd"],setup(B,{emit:R,expose:F}){const D=async oe=>{var fe;event$1.off("section-click",noteClick),R("startRender");const le=await request$1$1.get(oe);if(K.value){let he=document.createElement("div");he.innerHTML=le,(fe=K.value)==null||fe.appendChild(he.firstElementChild);let ge=document.querySelector("#osmdSvgPage1");const ce=document.getElementById("svgContainer");let me=ge==null?void 0:ge.getAttribute("width"),ye=ge==null?void 0:ge.getAttribute("height");if(me=isNaN(Number(me))?0:Number(me),ye=isNaN(Number(ye))?0:Number(ye),me&&ye){let ve=ye/me,pe=(ce==null?void 0:ce.offsetWidth)||document.body.clientWidth;state$2.zoom=pe/me,ge==null||ge.setAttribute("width",pe),ge==null||ge.setAttribute("height",pe*ve+"")}R("loaddingEnd")}},G=async oe=>{var fe,he,ge,ce,me,ye,ve,pe,be,xe,ue,_e,Be,Ae,Pe,Ie,Ce;const le=await request$1$1.get(oe);if(state$4.sett.scoreSize=((fe=le==null?void 0:le.osmd)==null?void 0:fe.scoreSize)||"middle",le&&Array.isArray(le.times)){for(let Te=0;Te{event$1.off("section-click",noteClick),R("startRender"),Z.value=useOsmd(K,{...W.value,drawPartNames:q.value},U.value).value,Z.value&&(useEngravingRules(Z.value,U.value),state.isFirstPlay=!1,event$1.on("section-click",noteClick))},Q=async oe=>{await D(oe.svg),G(oe.json)};onMounted(async()=>{var le,fe,he,ge,ce,me;if(rendered.value)return;if(state$4.sett.type==="staff"&&!((le=state$2==null?void 0:state$2.activeDetail)!=null&&le.musicSvg)||state$4.sett.type==="jianpu"&&state$4.sett.keySignature&&!((fe=state$2==null?void 0:state$2.activeDetail)!=null&&fe.musicFirstSvg)||state$4.sett.type==="jianpu"&&!state$4.sett.keySignature&&!((he=state$2==null?void 0:state$2.activeDetail)!=null&&he.musicJianSvg)){j();return}let oe=null;try{state$4.sett.type==="staff"&&((ge=state$2.activeDetail)==null?void 0:ge.musicSvg)?oe=JSON.parse(state$2.activeDetail.musicSvg):state$4.sett.keySignature&&((ce=state$2.activeDetail)==null?void 0:ce.musicFirstSvg)?oe=JSON.parse(state$2.activeDetail.musicFirstSvg):(me=state$2.activeDetail)!=null&&me.musicJianSvg&&(oe=JSON.parse(state$2.activeDetail.musicJianSvg))}catch(ye){console.error(ye),state$2.renderType="native"}oe&&!B.isSoundEffect?Q(oe):j()}),onUnmounted(()=>{event$1.off("section-click",noteClick)}),watch([Y,Z],async()=>{if(Z&&Z.value&&Y.value)try{R("startRender"),await useOsmdLoader(Z.value,Y.value),R("rerender",Z.value),event$1.emit("loaded"),ne()}catch(oe){console.error(oe),R("renderError")}},{immediate:!0});const J=async({score:oe}={})=>{const le=oe||Y.value;Toast("\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E..."),setTimeout(async()=>{if(Z&&Z.value&&le){await Z.value.clear(),j();try{state$2.section=[],state$2.sectionStatus=!1,await useOsmdLoader(Z.value,le),R("rerender",Z.value),event$1.emit("loaded"),ne()}catch(fe){console.error(fe),R("renderError")}}},100)},te=async()=>{var oe;await((oe=Z.value)==null?void 0:oe.render())},ne=()=>{var fe,he;const oe=Array.from(K.value.querySelectorAll(".staffline")),le=4;for(let ge=0,ce=oe.length;ge .vf-voices")),ue=Array.from(me.querySelectorAll(".vf-measure > .vf-beams")),_e=Array.from(me.querySelectorAll(".vf-ties")),Be=Array.from(me.querySelectorAll(".vf-line")),Ae=Array.from(me.querySelectorAll(".vf-measure > .vf-stave text"));Array.from(me.querySelectorAll(".vf-measure > .vf-stave rect[fill=none]"));const Pe=Array.from(me.querySelectorAll(".vf-measure .vf-staveSection")),Ie=["To Coda","D.S. al Coda","Coda"];Ae.filter(ke=>Ie.includes(ke.textContent||"")).forEach(ke=>{ue.forEach($e=>{var qe;const We=re(ke,$e),Ve=ke==null?void 0:ke.previousSibling;if(We.isCollision){const et=Number(ke.getAttribute("y"))-(We.b1-We.t2)-le+"";ke.setAttribute("y",et),Ve&&Ve.getAttribute("stroke-width")==="0.3"&&Ve.getAttribute("stroke")==="none"&&(((qe=Ve.getAttribute("d"))==null?void 0:qe.length)||0)>3e3&&(Ve.style.transform=`translateY(${-(We.b1-We.t2+le)}px)`)}}),xe.forEach($e=>{var qe;const We=re(ke,$e),Ve=ke==null?void 0:ke.previousSibling;if(We.isCollision){const et=Number(ke.getAttribute("y"))-(We.b1-We.t2)-le+"";ke.setAttribute("y",et),Ve&&Ve.getAttribute("stroke-width")==="0.3"&&Ve.getAttribute("stroke")==="none"&&(((qe=Ve.getAttribute("d"))==null?void 0:qe.length)||0)>3e3&&(Ve.style.transform=`translateY(${-(We.b1-We.t2+le)}px)`)}})}),Pe.forEach(ke=>{let $e=0;[...be,..._e,...xe].forEach(We=>{const Ve=re(ke,We);Ve.isCollision&&($e=Math.min($e,Ve.t2-Ve.b1-le))}),ke.style.transform=`translateY(${$e}px)`});let Ce=Array.from(me.querySelectorAll(".vf-text > text")).filter(ke=>ke.getBBox().y text")).filter(ke=>ke.getBBox().y{const $e=ke.getBBox();$e.y1&&Se.forEach(ke=>{ke.setAttribute("y",Te+"")}),Ce.forEach(ke=>{[...be,...pe,...Be].forEach($e=>{let We=re(ke,$e);if(We.isCollision&&We.b1{Ce.forEach($e=>{if(ke.parentNode!==$e.parentNode&&!["marcato","legato"].includes(ke.textContent))if(["marcato","legato"].includes($e.textContent)){if(re(ke,$e,30,30).isCollision){const Ve=ke.getBBox();$e.setAttribute("x",Ve.x+Ve.width+5+""),$e.setAttribute("y",Ve.y+Ve.height-5+"")}}else{const We=re(ke,$e);if(We.isCollision){const Ve=Number(ke.getAttribute("y")),qe=We.b2-We.t2<24?24:We.b2-We.t2;$e.setAttribute("y",Ve-qe-.5+"")}}})});const Ne=Array.from(me.querySelectorAll(".vf-text > text")).filter(ke=>ke.getBBox().y>ve),Ge=Array.from(me.querySelectorAll(".vf-line")).filter(ke=>ke.getBBox().y>ve);for(let ke=0;ke{[...pe].forEach($e=>{let We=re(ke,$e);We.isCollision&&ke.setAttribute("y",We.b2+Math.abs(We.t1-Number(ke.getAttribute("y")))+"")})}),Ge.forEach(ke=>{var We;const $e=[];if((We=ke.nextElementSibling)!=null&&We.classList.contains("vf-line")&&Ne.forEach(Ve=>{let qe=re(ke,Ve,20,20);qe.isCollision&&$e.push({text:Ve,result:qe})}),$e.length===1){const Ve=$e[0].result,qe=$e[0].text;Ve.x2+Ve.w2Ve.x1+Ve.w1?Math.abs(Ve.y2-Ve.y1)>10&&qe.setAttribute("y",Ve.y1+Ve.h2/2+""):Math.abs(Ve.x2-Ve.x1)10&&qe.setAttribute("y",Ve.y1+Ve.h2/2+"")):(qe.setAttribute("x",Ve.x1+Ve.w1+5+""),Math.abs(Ve.y2-Ve.y1)>10&&qe.setAttribute("y",Ve.y1+Ve.h2/2+""))}else if($e.length===2){const Ve=$e[0].result,qe=$e[0].text,et=$e[1].result,ot=$e[1].text;qe.setAttribute("x",Ve.x1-Ve.w2-5+""),Math.abs(Ve.y2-Ve.y1)>10&&qe.setAttribute("y",Ve.y1+Ve.h2/2+""),ot.setAttribute("x",et.x1+et.w1+5+""),Math.abs(et.y2-et.y1)>10&&ot.setAttribute("y",et.y1+et.h2/2+"")}}),Ne.forEach(ke=>{Ne.forEach($e=>{if(ke.parentNode!==$e.parentNode&&!["marcato","legato","cresc.","Cantabile"].includes(ke.textContent))if(["marcato","legato","cresc.","Cantabile"].includes($e.textContent)){if(re(ke,$e,30,30).isCollision){const Ve=ke.getBBox();$e.setAttribute("x",Ve.x+Ve.width+5+""),$e.setAttribute("y",Ve.y+Ve.height-5+"")}}else{const We=re(ke,$e);We.isCollision&&$e.setAttribute("y",We.y1+We.h1+We.h2+"")}})})}setTimeout(()=>ie())},ie=()=>{if(!K.value)return;const oe=K.value.querySelector("svg");if(!oe)return;const le=oe.getBBox();let fe=Array.from(K.value.querySelectorAll(".vf-stavetempo")).reduce((ye,ve)=>{var pe;return ye.find(be=>be.outerHTML===ve.outerHTML)?(pe=ve==null?void 0:ve.parentNode)==null||pe.removeChild(ve):ye.push(ve),ye},[]);const he=Array.from(K.value.querySelectorAll(".staffline")),ge=Array.from(K.value.querySelectorAll(".staffline > .vf-measure")),ce=Array.from(K.value.querySelectorAll(".staffline > .vf-text")),me=Array.from(K.value.querySelectorAll(".staffline > .vf-curve"));fe.forEach(ye=>{let ve=0;[...ge,...ce,...me].forEach(xe=>{const ue=re(ye,xe);ue.isCollision&&(ue.b1ue.l2||ue.l10&&([...he,...fe].forEach(xe=>{if(ye!=xe){const ue=re(ye,xe,Math.abs(be),Math.abs(ve));ue.isCollision&&(ve=ue.t2-ue.b1)}}),ye.style.transform=`translate(-${be/.7}px,${ve}px)`)}),le.y<0&&oe.setAttribute("height",Number(oe.getAttribute("height"))-le.y+10+"")},re=(oe,le,fe=0,he=0)=>{const ge=oe.getBBox(),ce=le.getBBox();let me=ge.y-he,ye=ge.x-fe,ve=ge.x+ge.width+fe,pe=ge.y+ge.height+he,be=ce.y,xe=ce.x,ue=ce.x+ce.width,_e=ce.y+ce.height;return peue||me>_e||vecreateVNode("div",{id:"svgContainer",class:styles$g.container,style:{position:"relative"}},[createVNode("div",{ref:K},null),B.showSection&&createVNode(Section,{style:{position:"absolute",width:"100%",height:"100%",zIndex:1,top:0,left:0}},null)])}});export{getTypes as $,styles$8 as A,BackIcon as B,Canvg as C,Dialog as D,evaluatingRef as E,startButtonShow as F,Grid as G,iconEvaluatingStart as H,ButtonIcon as I,setCurrentTime as J,ended as K,useClientType as L,MusicSheet as M,NoticeBar as N,OpenSheetMusicDisplay as O,Popup as P,permissionPopup as Q,refreshIndex as R,Section as S,Toast as T,iconColse as U,pause as V,Tabs as W,Tab as X,typeById as Y,FingeringComponent as Z,formatId as _,GridItem as a,useClickAway as a$,formatFixedKey as a0,useFingeringSrc as a1,getImageSize as a2,CellGroup as a3,Cell as a4,useDetail as a5,event as a6,useUser as a7,useSuspendPlay as a8,Buttons as a9,Field as aA,getTvIconUrl as aB,getEnvHostname as aC,score as aD,Popover as aE,Player as aF,changeAllMode as aG,resetPlayStatus as aH,getFixTime as aI,setCaptureMode as aJ,clearIntervalTimeline as aK,getNoteByMeasuresSlursStart as aL,getLeveByScore as aM,Switch as aN,noteClick as aO,sectionChange as aP,Speed as aQ,EventEmitter as aR,setPrefix as aS,useReload as aT,relationships as aU,getVoicePartInfo as aV,MultipleAudio as aW,idIsInClassIds as aX,appoggianceFormate as aY,useParent as aZ,useChildren as a_,modelType as aa,SoundEffect as ab,HelperPopup as ac,useFee as ad,changeSpeed as ae,setAudioInit as af,restPromptMain as ag,useFingering as ah,stopTick as ai,useScrollParent as aj,useEventListener as ak,useTabStatus as al,useRect as am,isHidden as an,useExpose as ao,cancelRaf as ap,raf$2 as aq,useTouch as ar,SwipeItem as as,preventDefault as at,clamp as au,useWindowSize as av,Swipe as aw,callInterceptor as ax,mountComponent as ay,usePopupState as az,useSpecialShapedScreen as b,fieldProps as b0,lodash as b1,Sticky as b2,Vex as b3,state as c,getParentNote as d,request$1$1 as e,getCustomInfo as f,getAllNodes as g,formatXML as h,getBoundingBoxByverticalNote as i,getLeveByScoreMeasure as j,classnames as k,event$1 as l,styles$g as m,index as n,onlyVisible as o,PageFormat as p,startRun as q,request as r,state$2 as s,useXml as t,useOriginSearch as u,svgtopng as v,changeMode as w,getDuration as x,useWiredHeadsetCheck as y,setPlayState as z};